diff --git a/lib/features/book_appointments/book_appointments_repo.dart b/lib/features/book_appointments/book_appointments_repo.dart index 1783556..8aafc9b 100644 --- a/lib/features/book_appointments/book_appointments_repo.dart +++ b/lib/features/book_appointments/book_appointments_repo.dart @@ -734,7 +734,7 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo { body: mapDevice, onFailure: (error, statusCode, {messageStatus, failureType}) { failure = failureType; - onError!(error); + onError?.call(error); }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) { try { diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index 20b64fd..f24766b 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -1009,7 +1009,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { (failure) async => await errorHandlerService.handleError(failure: failure), (apiResponse) { if (apiResponse.messageStatus == 2) { - onError!(apiResponse.errorMessage!); + onError?.call(apiResponse.errorMessage!); // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); } else if (apiResponse.messageStatus == 1) { dentalChiefComplaintsList = apiResponse.data!; diff --git a/lib/features/my_appointments/appointment_via_region_viewmodel.dart b/lib/features/my_appointments/appointment_via_region_viewmodel.dart index 3e3c3cd..9a3925d 100644 --- a/lib/features/my_appointments/appointment_via_region_viewmodel.dart +++ b/lib/features/my_appointments/appointment_via_region_viewmodel.dart @@ -110,7 +110,6 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier { ); } } - if (clinicId == 253) { { diff --git a/lib/presentation/book_appointment/laser/widgets/body_part_listing.dart b/lib/presentation/book_appointment/laser/widgets/body_part_listing.dart index 564c013..874749a 100644 --- a/lib/presentation/book_appointment/laser/widgets/body_part_listing.dart +++ b/lib/presentation/book_appointment/laser/widgets/body_part_listing.dart @@ -43,85 +43,88 @@ class BodyPartsListing extends StatelessWidget { itemBuilder: (BuildContext context, int index) { return SizedBox( height: 80, width: 80,).toShimmer2(isShow: isLoading); })), - GridView.builder( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - childAspectRatio: 85 / 107, - crossAxisSpacing: 4.h, - mainAxisSpacing: 21.h), - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: parts.length, - // padding: fullBody != null ? EdgeInsets.only(top: 16) : EdgeInsets.zero, - padding: EdgeInsets.zero, - itemBuilder: (BuildContext context, int index) { - bool _isSelected = - selectedPart.any((file) => file.id == parts[index].id); - return InkWell( - onTap: () { - onPartSelected(parts[index]); - }, - child: AnimatedOpacity( - opacity: 1.0, - duration: Duration(milliseconds: 200), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AspectRatio( - aspectRatio: 97 / 97, - child: FittedBox( - fit: BoxFit.fitWidth, - child: Stack( - alignment: Alignment.topRight, - children: [ - Container( - margin: EdgeInsets.only(top: 5.h, right: 5.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.0), - border: Border.all( - color: _isSelected - ? AppColors.primaryRedColor - : AppColors.borderGrayColor, - width: 2.h), - ), - child: LaserBodyParts().getCategoryImage(isMale, - laserCategoryID, parts[index].mappingCode!), - ), - if (_isSelected) + Visibility( + visible: !isLoading, + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + childAspectRatio: 85 / 107, + crossAxisSpacing: 4.h, + mainAxisSpacing: 21.h), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: parts.length, + // padding: fullBody != null ? EdgeInsets.only(top: 16) : EdgeInsets.zero, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + bool _isSelected = + selectedPart.any((file) => file.id == parts[index].id); + return InkWell( + onTap: () { + onPartSelected(parts[index]); + }, + child: AnimatedOpacity( + opacity: 1.0, + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AspectRatio( + aspectRatio: 97 / 97, + child: FittedBox( + fit: BoxFit.fitWidth, + child: Stack( + alignment: Alignment.topRight, + children: [ Container( - width: 18.h, - height: 18.h, - child: Icon(Icons.done, - color: Colors.white, size: 12.h), + margin: EdgeInsets.only(top: 5.h, right: 5.h), decoration: BoxDecoration( - color: AppColors.primaryRedColor, - borderRadius: BorderRadius.circular(30.h), + borderRadius: BorderRadius.circular(15.0), + border: Border.all( + color: _isSelected + ? AppColors.primaryRedColor + : AppColors.borderGrayColor, + width: 2.h), ), + child: LaserBodyParts().getCategoryImage(isMale, + laserCategoryID, parts[index].mappingCode!), ), - ], + if (_isSelected) + Container( + width: 18.h, + height: 18.h, + child: Icon(Icons.done, + color: Colors.white, size: 12.h), + decoration: BoxDecoration( + color: AppColors.primaryRedColor, + borderRadius: BorderRadius.circular(30.h), + ), + ), + ], + ), ), ), - ), - SizedBox(height: 6.h), - Expanded( - child: Text( - context - .read() - .getLaserProcedureNameWRTLanguage(parts[index]), - style: TextStyle( - fontSize: 12.fSize, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.48, + SizedBox(height: 6.h), + Expanded( + child: Text( + context + .read() + .getLaserProcedureNameWRTLanguage(parts[index]), + style: TextStyle( + fontSize: 12.fSize, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.48, + ), + maxLines: 1, ), - maxLines: 1, ), - ), - ], + ], + ), ), - ), - ); - }, + ); + }, + ), ), ], ); diff --git a/lib/presentation/book_appointment/select_clinic_page.dart b/lib/presentation/book_appointment/select_clinic_page.dart index f5e534e..d0bd740 100644 --- a/lib/presentation/book_appointment/select_clinic_page.dart +++ b/lib/presentation/book_appointment/select_clinic_page.dart @@ -281,7 +281,7 @@ class _SelectClinicPageState extends State { }); } - Widget getRegionalSelectionWidget(AppointmentViaRegionViewmodel data) { + Widget getRegionalSelectionWidget(AppointmentViaRegionViewmodel data) { if (data.bottomSheetState == AppointmentViaRegionState.REGION_SELECTION) { return RegionBottomSheetBody(); } @@ -303,7 +303,10 @@ class _SelectClinicPageState extends State { id = regionalViewModel.selectedHospital?.patientDoctorAppointmentList?.first.projectID?.toString() ?? ""; } if (bookAppointmentsViewModel.selectedClinic.clinicID == 17) { - if (!appState.isAuthenticated) { + if (appState.isAuthenticated) { + initDentalAppointment(); + return SizedBox.shrink(); + }else { bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true); } } @@ -459,8 +462,21 @@ class _SelectClinicPageState extends State { isCloseButtonVisible: true, ); } else { - // Navigate to Chief Complaint Screen + bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true); + Navigator.of(context).push( + CustomPageRoute( + page: DentalChiefComplaintsPage(), + ), + ); } }); } + + void initDentalAppointment() async { + await Future.delayed(Duration(milliseconds: 300)); + initDentalAppointmentBookingFlow(int.parse(bookAppointmentsViewModel + .currentlySelectedHospitalFromRegionFlow ?? + "0")); + return; + } } diff --git a/lib/services/dialog_service.dart b/lib/services/dialog_service.dart index 9dc46ad..2982f92 100644 --- a/lib/services/dialog_service.dart +++ b/lib/services/dialog_service.dart @@ -59,15 +59,14 @@ class DialogServiceImp implements DialogService { onOkPressed: () { if (onOkPressed != null) { onOkPressed(); - } else { - context.pop(); } - context.pop(); + context.pop(); }, onCancelPressed: () { if (onCancelPressed != null) { - context.pop(); + onCancelPressed(); } + context.pop(); }, ), ); diff --git a/lib/widgets/buttons/custom_button.dart b/lib/widgets/buttons/custom_button.dart index 73885b0..f5ac258 100644 --- a/lib/widgets/buttons/custom_button.dart +++ b/lib/widgets/buttons/custom_button.dart @@ -60,7 +60,7 @@ class CustomButton extends StatelessWidget { color: isDisabled ? backgroundColor.withOpacity(.5) : backgroundColor, borderRadius: borderRadius, customBorder: BorderRadius.circular(borderRadius), - side: borderSide ?? BorderSide(width: borderWidth.h, color: isDisabled ? borderColor.withValues(alpha: 0.5) : borderColor)), + side: borderSide ?? BorderSide(width: borderWidth.h, color: isDisabled ? Colors.transparent : borderColor)), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,