From e64f147f4968027cf8c404952f09dea99d11e83f Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 25 Jun 2026 15:12:22 +0300 Subject: [PATCH] updates --- lib/core/api/api_client.dart | 4 +- .../my_appointments_view_model.dart | 7 +- .../appointment_details_page.dart | 10 +++ .../appointment_payment_page.dart | 8 +-- .../widgets/select_gender_widget.dart | 9 ++- lib/presentation/home/landing_page.dart | 68 ++++++++++--------- 6 files changed, 65 insertions(+), 41 deletions(-) diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index 56eadd57..6a44cb0e 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -210,8 +210,8 @@ class ApiClientImp implements ApiClient { body['TokenID'] = "@dm!n"; } - body['TokenID'] = "@dm!n"; - // body['PatientID'] = 255375; + // body['TokenID'] = "@dm!n"; + // body['PatientID'] = 4769748; // body['PatientID'] = 89754444; // body['PatientTypeID'] = 1; // body['PatientOutSA'] = 0; diff --git a/lib/features/my_appointments/my_appointments_view_model.dart b/lib/features/my_appointments/my_appointments_view_model.dart index 0862c40d..9182f9e7 100644 --- a/lib/features/my_appointments/my_appointments_view_model.dart +++ b/lib/features/my_appointments/my_appointments_view_model.dart @@ -588,7 +588,12 @@ class MyAppointmentsViewModel extends ChangeNotifier { final result = await myAppointmentsRepo.confirmAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel); result.fold( - (failure) async => await errorHandlerService.handleError(failure: failure), + // (failure) async => await errorHandlerService.handleError(failure: failure), + (failure) async { + if(onError != null) { + onError(failure.message); + } + }, (apiResponse) { if (apiResponse.messageStatus == 2) { onError!(apiResponse.errorMessage!); diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index d2faf2b1..4d181230 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -1216,6 +1216,16 @@ class _AppointmentDetailsPageState extends State { isDismissible: false, isFullScreen: false, isSuccessDialog: true); + }, + onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); }); // LoaderBottomSheet.hideLoader(); case 15: diff --git a/lib/presentation/appointments/appointment_payment_page.dart b/lib/presentation/appointments/appointment_payment_page.dart index 66c88a28..46130b12 100644 --- a/lib/presentation/appointments/appointment_payment_page.dart +++ b/lib/presentation/appointments/appointment_payment_page.dart @@ -232,8 +232,8 @@ class _AppointmentPaymentPageState extends State { "0", widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? "true" : "false", widget.patientAppointmentHistoryResponseModel.appointmentDate!, - widget.patientAppointmentHistoryResponseModel.appointmentNo!, - widget.patientAppointmentHistoryResponseModel.doctorID!, + widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), + widget.patientAppointmentHistoryResponseModel.doctorID.toString(), transactionID: transID, fileNumber: appState.getAuthenticatedUser()!.patientId.toString(), orderDescription: "Appointment Payment", @@ -455,8 +455,8 @@ class _AppointmentPaymentPageState extends State { "0", widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? "true" : "false", widget.patientAppointmentHistoryResponseModel.appointmentDate!, - widget.patientAppointmentHistoryResponseModel.appointmentNo!, - widget.patientAppointmentHistoryResponseModel.doctorID!, + widget.patientAppointmentHistoryResponseModel.appointmentNo.toString(), + widget.patientAppointmentHistoryResponseModel.doctorID.toString(), transactionID: transID, fileNumber: appState.getAuthenticatedUser()!.patientId.toString(), amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(), diff --git a/lib/presentation/blood_donation/widgets/select_gender_widget.dart b/lib/presentation/blood_donation/widgets/select_gender_widget.dart index 1368c4e3..e51d3e78 100644 --- a/lib/presentation/blood_donation/widgets/select_gender_widget.dart +++ b/lib/presentation/blood_donation/widgets/select_gender_widget.dart @@ -57,9 +57,12 @@ class SelectGenderWidget extends StatelessWidget { ), ], ).paddingSymmetrical(16.h, 16.h).onPress(() { - final genderValue = isArabic - ? GenderTypeEnum.values[index].typeAr - : GenderTypeEnum.values[index].type; + final genderValue = + // isArabic + // ? GenderTypeEnum.values[index].typeAr + + // : + GenderTypeEnum.values[index].type; bloodDonationViewModel.onGenderChange(genderValue); Navigator.of(context).pop(); })); diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 531b310a..85f1e972 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -448,31 +448,31 @@ class _LandingPageState extends State { : SizedBox.shrink(), // Offers And Discounts Carousel - Auto-scrolling from right to left - appState.isAuthenticated && appState.isEnabledOffersAndDiscountsCarousel - ? Column( - children: [ - SizedBox(height: 12.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - ("${LocaleKeys.offers.tr(context: context)} & ${LocaleKeys.discount.tr(context: context)}").toText16(isBold: true), - Row( - children: [ - LocaleKeys.viewAll.tr(context: context).toText14(color: AppColors.primaryRedColor, isBold: true), - SizedBox(width: 2.h), - Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 14.h), - ], - ), - ], - ).paddingSymmetrical(24.h, 0.h).onPress(() { - Navigator.of(context).push(CustomPageRoute(page: OffersAndDiscountsPage())); - }), - SizedBox(height: 16.h), - OffersAndDiscountsCarousel().paddingSymmetrical(24.h, 0.h), - SizedBox(height: 18.h), - ], - ) - : SizedBox.shrink(), + // appState.isAuthenticated && appState.isEnabledOffersAndDiscountsCarousel + // ? Column( + // children: [ + // SizedBox(height: 12.h), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // ("${LocaleKeys.offers.tr(context: context)} & ${LocaleKeys.discount.tr(context: context)}").toText16(isBold: true), + // Row( + // children: [ + // LocaleKeys.viewAll.tr(context: context).toText14(color: AppColors.primaryRedColor, isBold: true), + // SizedBox(width: 2.h), + // Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 14.h), + // ], + // ), + // ], + // ).paddingSymmetrical(24.h, 0.h).onPress(() { + // Navigator.of(context).push(CustomPageRoute(page: OffersAndDiscountsPage())); + // }), + // SizedBox(height: 16.h), + // OffersAndDiscountsCarousel().paddingSymmetrical(24.h, 0.h), + // SizedBox(height: 18.h), + // ], + // ) + // : SizedBox.shrink(), appState.isAuthenticated ? Column( @@ -516,7 +516,7 @@ class _LandingPageState extends State { ), ).paddingSymmetrical(24.h, 16.h) : myAppointmentsVM.patientAppointmentsHistoryList.isNotEmpty - ? myAppointmentsVM.patientAppointmentsHistoryList.length == 1 + ? myAppointmentsVM.patientAppointmentsHistoryList.length == 1 && !immediateLiveCareVM.patientHasPendingLiveCareRequest ? Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, @@ -536,9 +536,11 @@ class _LandingPageState extends State { height: isTablet ? 290.h : 255.h, child: ListView.separated( scrollDirection: Axis.horizontal, - itemCount: myAppointmentsVM.patientAppointmentsHistoryList.length < 3 - ? myAppointmentsVM.patientAppointmentsHistoryList.length - : 3, + itemCount: () { + final int baseCount = + myAppointmentsVM.patientAppointmentsHistoryList.length + (immediateLiveCareVM.patientHasPendingLiveCareRequest ? 1 : 0); + return baseCount < 3 ? baseCount : 3; + }(), shrinkWrap: true, padding: EdgeInsets.only(left: 16.h, right: 16.h), itemBuilder: (context, index) { @@ -571,10 +573,14 @@ class _LandingPageState extends State { height: 255.h + 20 + 30, // itemHeight + shadow padding (10 top + 10 bottom) + pagination dots space child: Builder( builder: (context) { + final int baseAppointmentCount = myAppointmentsVM.patientAppointmentsHistoryList.length; + final int liveCareCount = immediateLiveCareVM.patientHasPendingLiveCareRequest ? 1 : 0; + final int totalCount = baseAppointmentCount + liveCareCount; + final int swiperItemCount = myAppointmentsVM.isMyAppointmentsLoading ? 3 - : myAppointmentsVM.patientAppointmentsHistoryList.length < 3 - ? myAppointmentsVM.patientAppointmentsHistoryList.length + : totalCount < 3 + ? totalCount : 3; final bool isArabic = appState.isArabic(); return Swiper(