mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-26 07:29:40 +00:00
make the UI and link it with its blocs
This commit is contained in:
@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../utils/resource_manager/color_manager.dart';
|
||||
import '../../domain/booking_model.dart';
|
||||
|
||||
class BookingCardWidget extends StatelessWidget {
|
||||
const BookingCardWidget({
|
||||
super.key,
|
||||
required this.bookingModel,
|
||||
});
|
||||
|
||||
final BookingModel bookingModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
color: ColorsManager.onPrimaryColor,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
bookingModel.roomName,
|
||||
style: TextStyle(
|
||||
color: ColorsManager.blackColor,
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Text(
|
||||
'Booking Date',
|
||||
style: TextStyle(
|
||||
color: ColorsManager.grayColor,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
bookingModel.date,
|
||||
style: TextStyle(
|
||||
color: ColorsManager.blackColor,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Time slot',
|
||||
style: TextStyle(
|
||||
color: ColorsManager.grayColor,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
bookingModel.timeSlot,
|
||||
style: TextStyle(
|
||||
color: ColorsManager.blackColor,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 80,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'cost',
|
||||
style: TextStyle(
|
||||
color: ColorsManager.grayColor,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
bookingModel.cost.toString(),
|
||||
style: TextStyle(
|
||||
color: ColorsManager.blackColor,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ class CurrentBalanceWidget extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
flex: 75,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(12),
|
||||
child: Column(
|
||||
@ -31,6 +31,7 @@ class CurrentBalanceWidget extends StatelessWidget {
|
||||
child: Text(
|
||||
'Current Balance',
|
||||
style: TextStyle(
|
||||
color: ColorsManager.blackColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 17,
|
||||
),
|
||||
@ -40,6 +41,7 @@ class CurrentBalanceWidget extends StatelessWidget {
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
@ -47,7 +49,7 @@ class CurrentBalanceWidget extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
color: ColorsManager.blueColor1,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 25),
|
||||
fontSize: 50),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
@ -65,7 +67,7 @@ class CurrentBalanceWidget extends StatelessWidget {
|
||||
),
|
||||
)),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
flex: 25,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.only(left: 15),
|
||||
|
@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../utils/helpers/app_size.dart';
|
||||
import '../../../../utils/resource_manager/color_manager.dart';
|
||||
import '../../../shared_widgets/default_button.dart';
|
||||
import '../blocs/past_bookings_bloc/past_bookings_bloc.dart';
|
||||
import 'booking_card_widget.dart';
|
||||
|
||||
class PastBookingsWidget extends StatelessWidget {
|
||||
const PastBookingsWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Past Bookings',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: ColorsManager.grayColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
BlocBuilder<PastBookingsBloc, PastBookingsState>(
|
||||
builder: (context, state) {
|
||||
if (state is PastBookingLoadingState) {
|
||||
//should use CustomLoadingWidget
|
||||
return CircularProgressIndicator();
|
||||
} else if (state is PastBookingErrorState) {
|
||||
//shold use CustomErrorWidget
|
||||
return DefaultButton(
|
||||
onPressed: () => context
|
||||
.read<PastBookingsBloc>()
|
||||
.add(GetPastBookingsEvent()),
|
||||
child: Text('Try again'),
|
||||
);
|
||||
} else if (state is PastBookingLoadedState) {
|
||||
return SizedBox(
|
||||
height: deviceHeight(context) * 0.3,
|
||||
child: state.pastBookings.isEmpty
|
||||
? Text('You Dont Have past Bookings')
|
||||
: ListView.separated(
|
||||
separatorBuilder: (context, index) => SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
itemCount: state.pastBookings.length,
|
||||
itemBuilder: (context, index) {
|
||||
final pastBooking = state.pastBookings[index];
|
||||
return BookingCardWidget(bookingModel: pastBooking);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return SizedBox();
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../utils/helpers/app_size.dart';
|
||||
import '../../../../utils/resource_manager/color_manager.dart';
|
||||
import '../../../shared_widgets/default_button.dart';
|
||||
import '../blocs/upcoming_bookings_bloc/upcoming_bookings_bloc.dart';
|
||||
import 'booking_card_widget.dart';
|
||||
|
||||
class UpcomingBookingsWidget extends StatelessWidget {
|
||||
const UpcomingBookingsWidget({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Upcoming Bookings',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: ColorsManager.grayColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
BlocBuilder<UpcomingBookingsBloc, UpcomingBookingsState>(
|
||||
builder: (context, state) {
|
||||
if (state is UpcomingBookingLoadingState) {
|
||||
//should use CustomLoadingWidget
|
||||
return CircularProgressIndicator();
|
||||
} else if (state is UpcomingBookingErrorState) {
|
||||
//shold use CustomErrorWidget
|
||||
return DefaultButton(
|
||||
onPressed: () => context
|
||||
.read<UpcomingBookingsBloc>()
|
||||
.add(GetUpcomingBookingsEvent()),
|
||||
child: Text('Try again'),
|
||||
);
|
||||
} else if (state is UpcomingBookingLoadedState) {
|
||||
return SizedBox(
|
||||
height: deviceHeight(context) * 0.3,
|
||||
child: state.upcomingBookings.isEmpty
|
||||
? Text('You Dont Have Upcoming Bookings')
|
||||
: ListView.separated(
|
||||
separatorBuilder: (context, index) => SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
itemCount: state.upcomingBookings.length,
|
||||
itemBuilder: (context, index) {
|
||||
final upcomingBooking = state.upcomingBookings[index];
|
||||
return BookingCardWidget(
|
||||
bookingModel: upcomingBooking);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return SizedBox();
|
||||
}
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user