From f3676f55969b0cfcfbf1ad8cea234c7d40260f4b Mon Sep 17 00:00:00 2001 From: tahaalam Date: Wed, 19 Nov 2025 14:39:25 +0300 Subject: [PATCH] ui issues resolve for ambulance and rrt request --- lib/extensions/string_extensions.dart | 2 + .../emergency_services_view_model.dart | 45 ++++++++++++++++--- .../RRT/rrt_map_screen.dart | 2 +- .../RRT/rrt_request_type_select.dart | 42 ++++++++++------- .../call_ambulance/call_ambulance_page.dart | 6 +-- .../call_ambulance/tracking_screen.dart | 19 +++++--- .../widgets/pickup_location.dart | 13 +++--- .../history/er_history_listing.dart | 18 +++----- .../history/widget/RequestStatus.dart | 2 +- .../widget/ambulance_history_item.dart | 2 + .../history/widget/rrt_item.dart | 2 + lib/widgets/CustomSwitch.dart | 4 +- lib/widgets/common_bottom_sheet.dart | 3 +- 13 files changed, 106 insertions(+), 54 deletions(-) diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 1a6d1cc..3c1765d 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -223,6 +223,7 @@ extension EmailValidator on String { FontWeight? weight, TextOverflow? textOverflow, double? letterSpacing = -0.4, + Color decorationColor =AppColors.errorColor }) => Text( this, @@ -236,6 +237,7 @@ extension EmailValidator on String { overflow: textOverflow, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), decoration: isUnderLine ? TextDecoration.underline : null, + decorationColor: decorationColor ), ); diff --git a/lib/features/emergency_services/emergency_services_view_model.dart b/lib/features/emergency_services/emergency_services_view_model.dart index 0c202df..a617f8d 100644 --- a/lib/features/emergency_services/emergency_services_view_model.dart +++ b/lib/features/emergency_services/emergency_services_view_model.dart @@ -2,13 +2,17 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices; +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/location_util.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/doctor_response_mapper.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/authentication/authentication_view_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_repo.dart'; @@ -34,6 +38,7 @@ import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart'; import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/rrt_map_screen.dart'; +import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/rrt_request_type_select.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/call_ambulance_page.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart'; @@ -44,6 +49,8 @@ import 'package:hmg_patient_app_new/routes/app_routes.dart' show AppRoutes; import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/expandable_bottom_sheet/model/BottomSheetType.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/order_tracking/order_tracking_state.dart'; @@ -490,8 +497,6 @@ class EmergencyServicesViewModel extends ChangeNotifier { return; } - if (transportationOptions.isNotEmpty) return; - int? id = appState.getAuthenticatedUser()?.patientId; LoaderBottomSheet.showLoader( loadingText: "Getting Ambulance Transport Option".needTranslation); @@ -864,10 +869,10 @@ class EmergencyServicesViewModel extends ChangeNotifier { Future cancelOrder(AmbulanceRequestOrdersModel? order, {bool shouldPop = false}) async { dialogService.showCommonBottomSheetWithoutH( - message: "Do you want to cancel the order".needTranslation, + message: "Do you want to cancel the request".needTranslation, onOkPressed: () async { navServices.pop(); - LoaderBottomSheet.showLoader(loadingText: "Cancelling Order".needTranslation); + LoaderBottomSheet.showLoader(loadingText: "Cancelling request".needTranslation); var response = await emergencyServicesRepo.cancelOrder(order?.iD, appState.getAuthenticatedUser()?.patientId ?? 0); LoaderBottomSheet.hideLoader(); response.fold((failure) => errorHandlerService.handleError(failure: failure), (success) { @@ -973,10 +978,10 @@ class EmergencyServicesViewModel extends ChangeNotifier { FutureOr cancelRRTOrder(int? orderID, {bool shouldPop = false}) async { dialogService.showCommonBottomSheetWithoutH( - message: "Do you want to cancel the order".needTranslation, + message: "Do you want to cancel the request".needTranslation, onOkPressed: () async { navServices.pop(); - LoaderBottomSheet.showLoader(loadingText: "Cancelling Order".needTranslation); + LoaderBottomSheet.showLoader(loadingText: "Cancelling request".needTranslation); var response = await emergencyServicesRepo.cancelRRTOrder(orderID); LoaderBottomSheet.hideLoader(); response.fold((failure) => errorHandlerService.handleError(failure: failure), (success) { @@ -1009,9 +1014,35 @@ class EmergencyServicesViewModel extends ChangeNotifier { print("the app state is ${appState.isAuthenticated}"); if (appState.isAuthenticated) { if(agreedToTermsAndCondition == false){ - dialogService.showErrorBottomSheet(message: "You Need To Agree To Terms And Conditions".needTranslation); + dialogService.showErrorBottomSheet(message: "You Need To Agree To Terms And Conditions".needTranslation, onOkPressed: (){ + if(navServices.context == null ) return; + showCommonBottomSheetWithoutHeight( + navServices.context!, + padding: EdgeInsets.only(top: 24.h), + titleWidget: Transform.flip( + flipX: isArabic, + child: Utils.buildSvgWithAssets( + icon: AppAssets.arrow_back, + iconColor: Color(0xff2B353E), + fit: BoxFit.contain, + ), + ).onPress(() { + navServices.pop(); + }), + // title: "Rapid Response Team (RRT)".needTranslation, + child: RrtRequestTypeSelect(), + isFullScreen: false, + isCloseButtonVisible: true, + hasBottomPadding: false, + backgroundColor: AppColors.bottomSheetBgColor, + callBackFunc: () { + navServices.pop(); + }, + ); + }); return; } + placeValueInController(); locationUtils!.getLocation( isShowConfirmDialog: true, onSuccess: (position) { diff --git a/lib/presentation/emergency_services/RRT/rrt_map_screen.dart b/lib/presentation/emergency_services/RRT/rrt_map_screen.dart index ca260d9..e249150 100644 --- a/lib/presentation/emergency_services/RRT/rrt_map_screen.dart +++ b/lib/presentation/emergency_services/RRT/rrt_map_screen.dart @@ -153,7 +153,7 @@ class RrtMapScreen extends StatelessWidget { ], ), CustomButton( - text: "Select Details".needTranslation, + text: "Submit Request".needTranslation, onPressed: () { LocationViewModel locationViewModel = context.read(); GeocodeResponse? response = locationViewModel.geocodeResponse; diff --git a/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart b/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart index 8c3db26..d9ab948 100644 --- a/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart +++ b/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart @@ -11,6 +11,7 @@ import 'package:hmg_patient_app_new/features/emergency_services/models/resp_mode import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/radio/custom_radio_button.dart'; import 'package:provider/provider.dart'; @@ -186,7 +187,7 @@ class RrtRequestTypeSelect extends StatelessWidget { final indexOfSelectedItem = selectedProcedure != null ? procedureList.indexOf(selectedProcedure) : -1; return RadioListTile( - title: (procedure.procedureName ?? "").toText12(color: AppColors.textColor), + title: (procedure.procedureName ?? "").toText16(color: AppColors.textColor, weight: FontWeight.w500), value: index, fillColor: WidgetStateProperty.resolveWith((states) { if (states.contains(WidgetState.selected)) { @@ -231,23 +232,32 @@ class RrtRequestTypeSelect extends StatelessWidget { ) { return Row( children: [ - Checkbox( - value: emergencyServicesVM.agreedToTermsAndCondition, - checkColor: AppColors.whiteColor, - fillColor: MaterialStateProperty.resolveWith((Set states) { - print("the state is ${states}"); - if (states.contains(WidgetState.selected)) { - return AppColors.errorColor; - } - return AppColors.whiteColor; - }), - onChanged: (value) { - emergencyServicesVM.setTermsAndConditions(value ?? false); - }), + SizedBox( + height: 18.h, + width: 18.w, + child: Checkbox( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + value: emergencyServicesVM.agreedToTermsAndCondition, + checkColor: AppColors.whiteColor, + fillColor: MaterialStateProperty.resolveWith((Set states) { + print("the state is ${states}"); + if (states.contains(WidgetState.selected)) { + return AppColors.errorColor; + } + return AppColors.whiteColor; + }), + onChanged: (value) { + emergencyServicesVM.setTermsAndConditions(value ?? false); + }), + ), Row( + spacing: 4.w, children: [ - LocaleKeys.agreeTo.tr().toText12(color: AppColors.textColor), - LocaleKeys.termsConditoins.tr().toText12(color: AppColors.errorColor, isUnderLine: true), + SizedBox.shrink(), + LocaleKeys.agreeTo.tr().toText16(color: AppColors.textColor, weight: FontWeight.w500), + LocaleKeys.termsConditoins.tr().toText16(color: AppColors.errorColor, isUnderLine: true, weight: FontWeight.w500).onPress(() { + Navigator.of(context).pushNamed('/terms'); + }), ], ), ], diff --git a/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart b/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart index 5e4b885..37ed26d 100644 --- a/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart +++ b/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart @@ -369,9 +369,9 @@ class CallAmbulancePage extends StatelessWidget { Row( children: [ hospitalAndPickUpItemContent( - title: '', + title: 'Appointment', subTitle: "Have any appointment".needTranslation, - leadingIcon: AppAssets.appointment_checkin_icon, + leadingIcon: AppAssets.appointment_calendar_icon, ), CustomSwitch( value: context @@ -405,7 +405,7 @@ class CallAmbulancePage extends StatelessWidget { borderRadius: 12.h, color: AppColors.greyColor, ), - child: Utils.buildSvgWithAssets(icon: leadingIcon), + child: Utils.buildSvgWithAssets(icon: leadingIcon, iconColor: AppColors.greyTextColor), ); } diff --git a/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart b/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart index 87bbead..4a9231a 100644 --- a/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart +++ b/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart @@ -56,7 +56,8 @@ class TrackingScreen extends StatelessWidget { visible: state == OrderTrackingState.ended, child: SafeArea( child: CustomButton( - height: 56.h, + height: 40.h, + iconSize: 18.w, backgroundColor: AppColors.bgGreenColor, borderColor: Colors.transparent, text: "Close".needTranslation, @@ -143,6 +144,8 @@ class TrackingScreen extends StatelessWidget { borderColor: AppColors.primaryRedColor, textColor: Colors.white, icon: AppAssets.cancel, + height: 40.h, + iconSize: 18.w, ), ], ); @@ -156,6 +159,7 @@ class TrackingScreen extends StatelessWidget { mapSection(context), CustomButton( height: 40.h, + iconSize: 18.w, backgroundColor: AppColors.lightRedButtonColor, borderColor: Colors.transparent, text: "Share Your Live Location on Whatsapp".needTranslation, @@ -225,13 +229,13 @@ class TrackingScreen extends StatelessWidget { width: 36.h, child: CustomButton( text: '', - iconSize: 16.h, + iconSize: 18.h, icon: AppAssets.call_fill, onPressed: () {}, backgroundColor: AppColors.lightRedButtonColor, iconColor: AppColors.primaryRedColor, borderColor: Colors.transparent, - height: 36.h, + height: 40.h, ), ) ], @@ -367,6 +371,7 @@ class TrackingScreen extends StatelessWidget { } contactSection() { + if(isRRTOrder) return SizedBox.shrink(); return Container( padding: EdgeInsets.all(16.h), decoration: RoundedRectangleBorder().toSmoothCornerDecoration( @@ -381,8 +386,12 @@ class TrackingScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 4.h, children: [ - "Contact Rapid Response Team (RRT)".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w600), - "0115259555".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), + "Contact".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w600), + "0115259555".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500).onPress((){ + launchUrl( + Uri.parse("tel://0115259555"), + ); + }), SizedBox(height: 8.h), ], ), diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart b/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart index 5d073d4..9410af1 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart @@ -29,7 +29,7 @@ class PickupLocation extends StatelessWidget { ), "Select Direction" .needTranslation - .toText14(color: AppColors.textColor, weight: FontWeight.w600), + .toText16(color: AppColors.textColor, weight: FontWeight.w600), SizedBox( height: 12.h, ), @@ -61,7 +61,7 @@ class PickupLocation extends StatelessWidget { ), "To Hospital" .needTranslation - .toText12(color: AppColors.textColor) + .toText14(color: AppColors.textColor, weight: FontWeight.w500) ], ).onPress((){ context @@ -78,7 +78,7 @@ class PickupLocation extends StatelessWidget { ), "From Hospital" .needTranslation - .toText12(color: AppColors.textColor) + .toText14(color: AppColors.textColor, weight: FontWeight.w500) ], ).onPress((){ context @@ -96,10 +96,11 @@ class PickupLocation extends StatelessWidget { builder: (context, directionValue, _) { return Column( spacing: 12.h, + crossAxisAlignment: CrossAxisAlignment.start, children: [ "Select Way" .needTranslation - .toText14(color: AppColors.textColor, weight: FontWeight.w600), + .toText16(color: AppColors.textColor, weight: FontWeight.w600), RadioGroup( groupValue: directionValue, onChanged: (value) { @@ -121,7 +122,7 @@ class PickupLocation extends StatelessWidget { ), "One Way" .needTranslation - .toText12(color: AppColors.textColor) + .toText12(color: AppColors.textColor, fontWeight: FontWeight.w500) ], ).onPress((){ context @@ -138,7 +139,7 @@ class PickupLocation extends StatelessWidget { ), "Two Way" .needTranslation - .toText12(color: AppColors.textColor) + .toText14(color: AppColors.textColor, weight: FontWeight.w500) ], ).onPress((){ context diff --git a/lib/presentation/emergency_services/history/er_history_listing.dart b/lib/presentation/emergency_services/history/er_history_listing.dart index 903e084..b98f2f1 100644 --- a/lib/presentation/emergency_services/history/er_history_listing.dart +++ b/lib/presentation/emergency_services/history/er_history_listing.dart @@ -38,11 +38,12 @@ class ErHistoryListing extends StatelessWidget { return Column( children: [ - orderChips(context, data.$2), + orderChips(context, data.$2, data.$1), Visibility( visible:data.$1.isNotEmpty == true, child: ListView.builder( + padding: EdgeInsets.only(top:24.h ), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount:data?.$1.length ?? 0, @@ -82,25 +83,18 @@ class ErHistoryListing extends StatelessWidget { ); } - orderChips(BuildContext context, bool isLoading) { + orderChips(BuildContext context, bool isLoading, List dataList) { - if (context - .read() - .displayList - ?.isEmpty == true) { + if (dataList?.isEmpty == true) { return SizedBox.shrink(); } - return - Selector( + return Selector( selector: (context, vm) => vm.currentlyDisplayedOrder, builder: (context, value, __) { return Row( spacing: 8.h, children: [ - if(context - .read() - .orderDisplayList - ?.isNotEmpty == true) + if(dataList?.isNotEmpty == true) AppCustomChipWidget( labelText: "All Facilities".needTranslation, shape: RoundedRectangleBorder( diff --git a/lib/presentation/emergency_services/history/widget/RequestStatus.dart b/lib/presentation/emergency_services/history/widget/RequestStatus.dart index de95bdc..4f39a49 100644 --- a/lib/presentation/emergency_services/history/widget/RequestStatus.dart +++ b/lib/presentation/emergency_services/history/widget/RequestStatus.dart @@ -54,8 +54,8 @@ class RequestStatus extends StatelessWidget { switch (status) { case 1: //pending case 2: - return AppColors.successColor;//processing case 3: //completed + return AppColors.successColor;//processing case 4: //cancel case 6: case 7: diff --git a/lib/presentation/emergency_services/history/widget/ambulance_history_item.dart b/lib/presentation/emergency_services/history/widget/ambulance_history_item.dart index 42bf257..f3ec388 100644 --- a/lib/presentation/emergency_services/history/widget/ambulance_history_item.dart +++ b/lib/presentation/emergency_services/history/widget/ambulance_history_item.dart @@ -60,6 +60,8 @@ class AmbulanceHistoryItem extends StatelessWidget { borderColor: AppColors.primaryRedColor, textColor: Colors.white, icon: AppAssets.cancel, + height: 40.h, + iconSize: 18.w, ), ], ).paddingAll(16.h), diff --git a/lib/presentation/emergency_services/history/widget/rrt_item.dart b/lib/presentation/emergency_services/history/widget/rrt_item.dart index 84108fb..0a3058d 100644 --- a/lib/presentation/emergency_services/history/widget/rrt_item.dart +++ b/lib/presentation/emergency_services/history/widget/rrt_item.dart @@ -55,6 +55,8 @@ class RRTItem extends StatelessWidget { borderColor: AppColors.primaryRedColor, textColor: Colors.white, icon: AppAssets.cancel, + height: 40.h, + iconSize: 18.w, ), ], ).paddingAll(16.h), diff --git a/lib/widgets/CustomSwitch.dart b/lib/widgets/CustomSwitch.dart index 784e446..bca4e69 100644 --- a/lib/widgets/CustomSwitch.dart +++ b/lib/widgets/CustomSwitch.dart @@ -21,7 +21,7 @@ class _CustomSwitchState extends State { width: 48.w, height: 30.h, decoration: BoxDecoration( - color: AppColors.switchBackgroundColor , + color: widget.value ? AppColors.switchBackgroundColor : AppColors.greyTextColor, borderRadius: BorderRadius.circular(18), ), child: AnimatedAlign( @@ -32,7 +32,7 @@ class _CustomSwitchState extends State { width: 28.w, height: 28.h, decoration: BoxDecoration( - color: AppColors.thumbColor, + color: widget.value? AppColors.thumbColor : AppColors.greyColor, shape: BoxShape.circle, ), ), diff --git a/lib/widgets/common_bottom_sheet.dart b/lib/widgets/common_bottom_sheet.dart index 6ad4d31..483a9e4 100644 --- a/lib/widgets/common_bottom_sheet.dart +++ b/lib/widgets/common_bottom_sheet.dart @@ -125,7 +125,8 @@ void showCommonBottomSheetWithoutHeight( reverseDuration: Duration(milliseconds: 300), ), constraints: BoxConstraints( - maxWidth: MediaQuery.of(context).size.width, // Full width + + maxWidth: MediaQuery.sizeOf(context).width//MediaQuery.of(context).size.width, // Full width ), context: context, isScrollControlled: true,