dental booking flow implemented
							parent
							
								
									c0606fb530
								
							
						
					
					
						commit
						30eb8bf5de
					
				| @ -0,0 +1,24 @@ | |||||||
|  | class DentalChiefComplaintsListResponseModel { | ||||||
|  |   int? projectID; | ||||||
|  |   int? iD; | ||||||
|  |   String? name; | ||||||
|  |   dynamic nameN; | ||||||
|  | 
 | ||||||
|  |   DentalChiefComplaintsListResponseModel({this.projectID, this.iD, this.name, this.nameN}); | ||||||
|  | 
 | ||||||
|  |   DentalChiefComplaintsListResponseModel.fromJson(Map<String, dynamic> json) { | ||||||
|  |     projectID = json['ProjectID']; | ||||||
|  |     iD = json['ID']; | ||||||
|  |     name = json['Name']; | ||||||
|  |     nameN = json['NameN']; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Map<String, dynamic> toJson() { | ||||||
|  |     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||||
|  |     data['ProjectID'] = this.projectID; | ||||||
|  |     data['ID'] = this.iD; | ||||||
|  |     data['Name'] = this.name; | ||||||
|  |     data['NameN'] = this.nameN; | ||||||
|  |     return data; | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,95 @@ | |||||||
|  | import 'dart:async'; | ||||||
|  | 
 | ||||||
|  | import 'package:flutter/material.dart'; | ||||||
|  | import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/core/app_state.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/core/dependencies.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/dental_chief_complaints_response_model.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/presentation/book_appointment/select_doctor_page.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/chief_complaint_card.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/theme/colors.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; | ||||||
|  | import 'package:provider/provider.dart'; | ||||||
|  | 
 | ||||||
|  | class DentalChiefComplaintsPage extends StatefulWidget { | ||||||
|  |   const DentalChiefComplaintsPage({super.key}); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   State<DentalChiefComplaintsPage> createState() => _DentalChiefComplaintsPageState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _DentalChiefComplaintsPageState extends State<DentalChiefComplaintsPage> { | ||||||
|  |   late AppState appState; | ||||||
|  |   late BookAppointmentsViewModel bookAppointmentsViewModel; | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   void initState() { | ||||||
|  |     scheduleMicrotask(() { | ||||||
|  |       bookAppointmentsViewModel.getDentalChiefComplaintsList(); | ||||||
|  |     }); | ||||||
|  |     super.initState(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false); | ||||||
|  |     appState = getIt.get<AppState>(); | ||||||
|  |     return CollapsingListView( | ||||||
|  |       title: "Dental Chief Complaints".needTranslation, | ||||||
|  |       child: SingleChildScrollView( | ||||||
|  |         child: Padding( | ||||||
|  |           padding: EdgeInsets.symmetric(horizontal: 24.h), | ||||||
|  |           child: Consumer<BookAppointmentsViewModel>(builder: (context, bookAppointmentsVM, child) { | ||||||
|  |             return ListView.separated( | ||||||
|  |               padding: EdgeInsets.only(top: 24.h), | ||||||
|  |               shrinkWrap: true, | ||||||
|  |               physics: NeverScrollableScrollPhysics(), | ||||||
|  |               itemCount: bookAppointmentsVM.isChiefComplaintsListLoading ? 5 : bookAppointmentsVM.dentalChiefComplaintsList.length, | ||||||
|  |               itemBuilder: (context, index) { | ||||||
|  |                 return bookAppointmentsVM.isChiefComplaintsListLoading | ||||||
|  |                     ? ChiefComplaintCard( | ||||||
|  |                         bookAppointmentsVM: bookAppointmentsVM, | ||||||
|  |                         dentalChiefComplaintsListResponseModel: DentalChiefComplaintsListResponseModel(), | ||||||
|  |                         isLoading: bookAppointmentsVM.isChiefComplaintsListLoading, | ||||||
|  |                       ) | ||||||
|  |                     : AnimationConfiguration.staggeredList( | ||||||
|  |                         position: index, | ||||||
|  |                         duration: const Duration(milliseconds: 500), | ||||||
|  |                         child: SlideAnimation( | ||||||
|  |                           verticalOffset: 100.0, | ||||||
|  |                           child: FadeInAnimation( | ||||||
|  |                             child: AnimatedContainer( | ||||||
|  |                               duration: Duration(milliseconds: 300), | ||||||
|  |                               curve: Curves.easeInOut, | ||||||
|  |                               decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), | ||||||
|  |                               child: ChiefComplaintCard( | ||||||
|  |                                 bookAppointmentsVM: bookAppointmentsVM, | ||||||
|  |                                 dentalChiefComplaintsListResponseModel: bookAppointmentsVM.dentalChiefComplaintsList[index], | ||||||
|  |                                 isLoading: bookAppointmentsVM.isChiefComplaintsListLoading, | ||||||
|  |                               ).onPress(() { | ||||||
|  |                                 bookAppointmentsVM.setSelectedChiefComplaintID(bookAppointmentsVM.dentalChiefComplaintsList[index].iD!); | ||||||
|  |                                 bookAppointmentsViewModel.setIsDoctorsListLoading(true); | ||||||
|  |                                 Navigator.of(context).push( | ||||||
|  |                                   CustomPageRoute( | ||||||
|  |                                     page: SelectDoctorPage(), | ||||||
|  |                                   ), | ||||||
|  |                                 ); | ||||||
|  |                               }), | ||||||
|  |                             ), | ||||||
|  |                           ), | ||||||
|  |                         ), | ||||||
|  |                       ); | ||||||
|  |               }, | ||||||
|  |               separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), | ||||||
|  |             ); | ||||||
|  |           }), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,38 @@ | |||||||
|  | import 'package:flutter/material.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/core/app_assets.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/core/app_state.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/core/dependencies.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/core/utils/utils.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/dental_chief_complaints_response_model.dart'; | ||||||
|  | import 'package:hmg_patient_app_new/theme/colors.dart'; | ||||||
|  | 
 | ||||||
|  | class ChiefComplaintCard extends StatelessWidget { | ||||||
|  |   ChiefComplaintCard({super.key, required this.isLoading, required this.bookAppointmentsVM, required this.dentalChiefComplaintsListResponseModel}); | ||||||
|  | 
 | ||||||
|  |   bool isLoading; | ||||||
|  |   BookAppointmentsViewModel bookAppointmentsVM; | ||||||
|  |   DentalChiefComplaintsListResponseModel dentalChiefComplaintsListResponseModel; | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     AppState appState = getIt.get<AppState>(); | ||||||
|  |     return Container( | ||||||
|  |       padding: EdgeInsets.all(16.h), | ||||||
|  |       decoration: RoundedRectangleBorder().toSmoothCornerDecoration( | ||||||
|  |         color: AppColors.whiteColor, | ||||||
|  |         borderRadius: 24.h, | ||||||
|  |         hasShadow: false, | ||||||
|  |       ), | ||||||
|  |       child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ | ||||||
|  |         Expanded(child: (isLoading ? "Cardiology" : dentalChiefComplaintsListResponseModel.name)!.toText16(isBold: true).toShimmer2(isShow: isLoading)), | ||||||
|  |         Transform.flip( | ||||||
|  |             flipX: appState.isArabic(), | ||||||
|  |             child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, width: 40.h, height: 40.h, fit: BoxFit.contain, iconColor: AppColors.textColor).toShimmer2(isShow: isLoading)), | ||||||
|  |       ]), | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | } | ||||||
					Loading…
					
					
				
		Reference in New Issue