From 8a11cc03cb2f888a62d31ecdd8d9ef10dff9e490 Mon Sep 17 00:00:00 2001 From: tahaalam Date: Sun, 5 Apr 2026 15:48:46 +0300 Subject: [PATCH] pickup direction bottom sheet added and previous radio bottom sheet removed --- assets/langs/ar-SA.json | 6 +- assets/langs/en-US.json | 6 +- .../emergency_services_repo.dart | 2 +- .../emergency_services_view_model.dart | 1 + lib/generated/locale_keys.g.dart | 6 +- .../call_ambulance/widgets/WayPickup.dart | 170 +++++++++ ...mbulance_option_selection_bottomsheet.dart | 2 +- .../widgets/pickup_location.dart | 326 ++++++++++-------- .../widgets/transport_option_Item.dart | 44 +-- .../emergency_services_page.dart | 40 ++- lib/theme/colors.dart | 2 +- 11 files changed, 430 insertions(+), 175 deletions(-) create mode 100644 lib/presentation/emergency_services/call_ambulance/widgets/WayPickup.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index fe4c04d8..9edf7969 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -1618,5 +1618,9 @@ "sortByLocation": "الترتيب حسب الموقع", "timeForFirstReminder": "وقت التذكير الأول", "reminderRemovalNote": "يمكنك إزالتها من التقويم الخاص بك لاحقاً عن طريق إيقاف تشغيل التذكير", - "communicationLanguage": "لغة التواصل" + "communicationLanguage": "لغة التواصل", + "oneWaySubtitle": "نقل من الموقع إلى المستشفى", + "twoWaySubtitle": "نقل من الموقع إلى المستشفى والعودة مرة أخرى", + "toHospitalSubtitle": "نقل من موقعك الحالي إلى المستشفى", + "fromHospitalSubtitle": "نقل من المستشفى إلى منزلك" } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 9419b5a3..6fbf6b2a 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -1611,5 +1611,9 @@ "sortByLocation": "Sort by location", "sortByNearestLocation": "Sort by nearest to your location", "giveLocationPermissionForNearestList": "Please grant location permission from app settings to see the nearest locations.", - "communicationLanguage": "Communication Language" + "communicationLanguage": "Communication Language", + "oneWaySubtitle": "Pickup from location to hospital", + "twoWaySubtitle": "Round trip from location to hospital and back", + "toHospitalSubtitle": "Transfer from your current location to the hospital", + "fromHospitalSubtitle": "Transfer from the hospital back to your home" } diff --git a/lib/features/emergency_services/emergency_services_repo.dart b/lib/features/emergency_services/emergency_services_repo.dart index f8eb896f..06a2e9ca 100644 --- a/lib/features/emergency_services/emergency_services_repo.dart +++ b/lib/features/emergency_services/emergency_services_repo.dart @@ -149,7 +149,7 @@ class EmergencyServicesRepoImp implements EmergencyServicesRepo { GenericApiModel>? apiResponse; Failure? failure; await apiClient.get( - "$GET_ALL_TRANSPORTATIONS_RC?patientID=$id", + "$GET_ALL_TRANSPORTATIONS_RC?patientID=1231755", isRCService: true, onFailure: (error, statusCode, {messageStatus, failureType}) { failure = failureType; diff --git a/lib/features/emergency_services/emergency_services_view_model.dart b/lib/features/emergency_services/emergency_services_view_model.dart index ec211793..bfe226f8 100644 --- a/lib/features/emergency_services/emergency_services_view_model.dart +++ b/lib/features/emergency_services/emergency_services_view_model.dart @@ -530,6 +530,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { void setTransportationOption(PatientERTransportationMethod item) { selectedTransportOption = item; + notifyListeners(); } void updateCallingPlace(AmbulanceCallingPlace? value) { diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index d3fcd24a..a507db37 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1597,6 +1597,7 @@ abstract class LocaleKeys { static const timeFor = 'timeFor'; static const hmgPolicies = 'hmgPolicies'; static const darkMode = 'darkMode'; + static const featureComingSoonDescription = 'featureComingSoonDescription'; static const generateAiAnalysisResult = 'generateAiAnalysisResult'; static const ratings = 'ratings'; static const hmgPharmacyText = 'hmgPharmacyText'; @@ -1611,6 +1612,9 @@ abstract class LocaleKeys { static const timeForFirstReminder = 'timeForFirstReminder'; static const reminderRemovalNote = 'reminderRemovalNote'; static const communicationLanguage = 'communicationLanguage'; - static const featureComingSoonDescription = 'featureComingSoonDescription'; + static const oneWaySubtitle = 'oneWaySubtitle'; + static const twoWaySubtitle = 'twoWaySubtitle'; + static const toHospitalSubtitle = 'toHospitalSubtitle'; + static const fromHospitalSubtitle = 'fromHospitalSubtitle'; } diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/WayPickup.dart b/lib/presentation/emergency_services/call_ambulance/widgets/WayPickup.dart new file mode 100644 index 00000000..ac05e482 --- /dev/null +++ b/lib/presentation/emergency_services/call_ambulance/widgets/WayPickup.dart @@ -0,0 +1,170 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.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/emergency_services/emergency_services_view_model.dart'; +import 'package:hmg_patient_app_new/features/emergency_services/models/AmbulanceCallingPlace.dart'; +import 'package:hmg_patient_app_new/features/emergency_services/models/ambulance_direction.dart'; +import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/transport_option_Item.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:provider/provider.dart'; + +import '../../../../generated/locale_keys.g.dart' show LocaleKeys; + +class WayPickup extends StatelessWidget { + final VoidCallback onTap; + const WayPickup({super.key, required this.onTap}); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.selectWay.tr(context: context) + .toText24(color: AppColors.textColor, isBold: true), + SizedBox( + height: 16.h, + ), + // LocaleKeys.selectDirection.tr(context: context) + // .toText16(color: AppColors.textColor, weight: FontWeight.w600), + // SizedBox( + // height: 12.h, + // ), + Column( + children: [ + SizedBox(height: 12.h), + Column( + mainAxisAlignment: MainAxisAlignment.start, + spacing:8.h, + children: [ + TransportOptionItem( + title: LocaleKeys.oneWay.tr(context: context), + subTitle: LocaleKeys.oneWaySubtitle.tr(context: context), + firstIcon: AppAssets.to_arrow, + middleIcon: AppAssets.to_arrow, + lastIcon: AppAssets.hospital, + shouldFlipIcon: true, + price: context.read().selectedTransportOption?.priceTotal?.toString()??"", + onTap: () { + context + .read() + .updateDirection( AmbulanceDirection.ONE_WAY); + onTap(); + }, + ), + + TransportOptionItem( + title: LocaleKeys.twoWay.tr(context: context), + subTitle: LocaleKeys.twoWaySubtitle.tr(context: context), + firstIcon: AppAssets.dual_arrow, + middleIcon: AppAssets.dual_arrow, + lastIcon: AppAssets.hospital, + price: ((context.read().selectedTransportOption?.priceTotal??0)*2).toString(), + onTap: () { + context + .read() + .updateDirection( AmbulanceDirection.TWO_WAY); + onTap(); + }, + ), + + // Visibility( + // visible: value == AmbulanceCallingPlace.TO_HOSPITAL, + // child: Selector( + // selector: (context, viewModel) => viewModel.ambulanceDirection, + // builder: (context, directionValue, _) { + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // SizedBox(height: 16.h), + // LocaleKeys.selectWay.tr(context: context) + // .toText16(color: AppColors.textColor, weight: FontWeight.w600), + // SizedBox(height: 12.h), + // Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Expanded( + // child: Row( + // children: [ + // Radio( + // value: AmbulanceDirection.ONE_WAY, + // groupValue: directionValue, + // onChanged: (AmbulanceDirection? newValue) { + // if (newValue != null) { + // context + // .read() + // .updateDirection(newValue); + // } + // }, + // activeColor: AppColors.primaryRedColor, + // fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), + // ), + // LocaleKeys.oneWay.tr(context: context) + // .toText12(color: AppColors.textColor, fontWeight: FontWeight.w500) + // ], + // ).onPress(() { + // context + // .read() + // .updateDirection(AmbulanceDirection.ONE_WAY); + // }), + // ), + // Expanded( + // child: Row( + // children: [ + // Radio( + // value: AmbulanceDirection.TWO_WAY, + // groupValue: directionValue, + // onChanged: (AmbulanceDirection? newValue) { + // if (newValue != null) { + // context + // .read() + // .updateDirection(newValue); + // } + // }, + // activeColor: AppColors.primaryRedColor, + // fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), + // ), + // LocaleKeys.twoWay.tr(context: context) + // .toText14(color: AppColors.textColor, weight: FontWeight.w500) + // ], + // ).onPress(() { + // context + // + // .read() + // .updateDirection(AmbulanceDirection.TWO_WAY); + // }), + // ), + // ], + // ), + // ], + // ); + // }, + // ), + ], + ), + ], + ), + // Selector( + // selector: (context, viewModel) => viewModel.callingPlace, + // builder: (context, value, _) { + // return ; + // }, + // ), + SizedBox( + height: 16.h, + ), + // CustomButton( + // text: LocaleKeys.confirm.tr(context: context), + // onPressed: onTap, + // backgroundColor: AppColors.primaryRedColor, + // borderColor: AppColors.primaryRedColor, + // textColor: AppColors.whiteColor, + // iconColor: AppColors.whiteColor, + // ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/ambulance_option_selection_bottomsheet.dart b/lib/presentation/emergency_services/call_ambulance/widgets/ambulance_option_selection_bottomsheet.dart index be1d3800..a99a7bbd 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/ambulance_option_selection_bottomsheet.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/ambulance_option_selection_bottomsheet.dart @@ -29,7 +29,7 @@ class AmbulanceOptionSelectionBottomSheet extends StatelessWidget { itemBuilder: (_, index) => TransportOptionItem( title: Utils.getTextWRTCurrentLanguage(data[index].text, data[index].textN), subTitle: "", - firstIcon: AppAssets.location_pickup, + firstIcon: AppAssets.ambulance, middleIcon: AppAssets.to_arrow, lastIcon: AppAssets.hospital, price: data[index].priceTotal.toString(), 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 56a94e0f..d76e6192 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart @@ -1,11 +1,13 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.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/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/AmbulanceCallingPlace.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/ambulance_direction.dart'; +import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/transport_option_Item.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:provider/provider.dart'; @@ -13,7 +15,7 @@ import 'package:provider/provider.dart'; import '../../../../generated/locale_keys.g.dart' show LocaleKeys; class PickupLocation extends StatelessWidget { - final VoidCallback onTap; + final Function(AmbulanceCallingPlace) onTap; const PickupLocation({super.key, required this.onTap}); @override @@ -26,159 +28,189 @@ class PickupLocation extends StatelessWidget { SizedBox( height: 16.h, ), - LocaleKeys.selectDirection.tr(context: context) - .toText16(color: AppColors.textColor, weight: FontWeight.w600), - SizedBox( - height: 12.h, - ), - Selector( - selector: (context, viewModel) => viewModel.callingPlace, - builder: (context, value, _) { - return Column( + // LocaleKeys.selectDirection.tr(context: context) + // .toText16(color: AppColors.textColor, weight: FontWeight.w600), + // SizedBox( + // height: 12.h, + // ), + Column( + children: [ + SizedBox(height: 12.h), + Column( + mainAxisAlignment: MainAxisAlignment.start, + spacing:8.h, children: [ - SizedBox(height: 12.h), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: Row( - children: [ - Radio( - value: AmbulanceCallingPlace.TO_HOSPITAL, - groupValue: value, - onChanged: (AmbulanceCallingPlace? newValue) { - if (newValue != null) { - context - .read() - .updateCallingPlace(newValue); - } - }, - activeColor: AppColors.primaryRedColor, - fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), - ), - LocaleKeys.toHospital.tr(context: context) - .toText14(color: AppColors.textColor, weight: FontWeight.w500) - ], - ).onPress(() { - context - .read() - .updateCallingPlace(AmbulanceCallingPlace.TO_HOSPITAL); - }), - ), - Expanded( - child: Row( - children: [ - Radio( - value: AmbulanceCallingPlace.FROM_HOSPITAL, - groupValue: value, - onChanged: (AmbulanceCallingPlace? newValue) { - if (newValue != null) { - context - .read() - .updateCallingPlace(newValue); - } - }, - activeColor: AppColors.primaryRedColor, - fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), - ), - LocaleKeys.fromHospital.tr(context: context) - .toText14(color: AppColors.textColor, weight: FontWeight.w500) - ], - ).onPress(() { - context - .read() - .updateCallingPlace(AmbulanceCallingPlace.FROM_HOSPITAL); - }), - ), - ], + TransportOptionItem( + title: LocaleKeys.toHospital.tr(context: context), + subTitle: LocaleKeys.toHospitalSubtitle.tr(context: context), + firstIcon: AppAssets.homeBottomFill, + middleIcon: AppAssets.to_arrow, + lastIcon: AppAssets.hospital, + price: context.read().selectedTransportOption?.priceTotal?.toString()??"", + onTap: () { + context.read() + .updateCallingPlace(AmbulanceCallingPlace.TO_HOSPITAL); + onTap(AmbulanceCallingPlace.TO_HOSPITAL); + }, ), - Visibility( - visible: value == AmbulanceCallingPlace.TO_HOSPITAL, - child: Selector( - selector: (context, viewModel) => viewModel.ambulanceDirection, - builder: (context, directionValue, _) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 16.h), - LocaleKeys.selectWay.tr(context: context) - .toText16(color: AppColors.textColor, weight: FontWeight.w600), - SizedBox(height: 12.h), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: Row( - children: [ - Radio( - value: AmbulanceDirection.ONE_WAY, - groupValue: directionValue, - onChanged: (AmbulanceDirection? newValue) { - if (newValue != null) { - context - .read() - .updateDirection(newValue); - } - }, - activeColor: AppColors.primaryRedColor, - fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), - ), - LocaleKeys.oneWay.tr(context: context) - .toText12(color: AppColors.textColor, fontWeight: FontWeight.w500) - ], - ).onPress(() { - context - .read() - .updateDirection(AmbulanceDirection.ONE_WAY); - }), - ), - Expanded( - child: Row( - children: [ - Radio( - value: AmbulanceDirection.TWO_WAY, - groupValue: directionValue, - onChanged: (AmbulanceDirection? newValue) { - if (newValue != null) { - context - .read() - .updateDirection(newValue); - } - }, - activeColor: AppColors.primaryRedColor, - fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), - ), - LocaleKeys.twoWay.tr(context: context) - .toText14(color: AppColors.textColor, weight: FontWeight.w500) - ], - ).onPress(() { - context - .read() - .updateDirection(AmbulanceDirection.TWO_WAY); - }), - ), - ], - ), - ], - ); - }, - ), - ) + + TransportOptionItem( + title: LocaleKeys.fromHospital.tr(context: context), + subTitle: LocaleKeys.fromHospitalSubtitle.tr(context: context), + firstIcon: AppAssets.hospital, + middleIcon: AppAssets.to_arrow, + lastIcon: AppAssets.hospital, + price: context.read().selectedTransportOption?.priceTotal?.toString()??"", + onTap: () { + context.read().updateCallingPlace(AmbulanceCallingPlace.FROM_HOSPITAL); + onTap(AmbulanceCallingPlace.FROM_HOSPITAL); + }, + ), + // Expanded( + // child: Row( + // children: [ + // Radio( + // value: AmbulanceCallingPlace.TO_HOSPITAL, + // groupValue: value, + // onChanged: (AmbulanceCallingPlace? newValue) { + // if (newValue != null) { + // context + // .read() + // .updateCallingPlace(newValue); + // } + // }, + // activeColor: AppColors.primaryRedColor, + // fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), + // ), + // LocaleKeys.toHospital.tr(context: context) + // .toText14(color: AppColors.textColor, weight: FontWeight.w500) + // ], + // ).onPress(() { + // context + // .read() + // .updateCallingPlace(AmbulanceCallingPlace.TO_HOSPITAL); + // }), + // ), + // Expanded( + // child: Row( + // children: [ + // Radio( + // value: AmbulanceCallingPlace.FROM_HOSPITAL, + // groupValue: value, + // onChanged: (AmbulanceCallingPlace? newValue) { + // if (newValue != null) { + // context + // .read() + // .updateCallingPlace(newValue); + // } + // }, + // activeColor: AppColors.primaryRedColor, + // fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), + // ), + // LocaleKeys.fromHospital.tr(context: context) + // .toText14(color: AppColors.textColor, weight: FontWeight.w500) + // ], + // ).onPress(() { + // context + // .read() + // .updateCallingPlace(AmbulanceCallingPlace.FROM_HOSPITAL); + // }), + // ), + // ], + // ), + // Visibility( + // visible: value == AmbulanceCallingPlace.TO_HOSPITAL, + // child: Selector( + // selector: (context, viewModel) => viewModel.ambulanceDirection, + // builder: (context, directionValue, _) { + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // SizedBox(height: 16.h), + // LocaleKeys.selectWay.tr(context: context) + // .toText16(color: AppColors.textColor, weight: FontWeight.w600), + // SizedBox(height: 12.h), + // Row( + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Expanded( + // child: Row( + // children: [ + // Radio( + // value: AmbulanceDirection.ONE_WAY, + // groupValue: directionValue, + // onChanged: (AmbulanceDirection? newValue) { + // if (newValue != null) { + // context + // .read() + // .updateDirection(newValue); + // } + // }, + // activeColor: AppColors.primaryRedColor, + // fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), + // ), + // LocaleKeys.oneWay.tr(context: context) + // .toText12(color: AppColors.textColor, fontWeight: FontWeight.w500) + // ], + // ).onPress(() { + // context + // .read() + // .updateDirection(AmbulanceDirection.ONE_WAY); + // }), + // ), + // Expanded( + // child: Row( + // children: [ + // Radio( + // value: AmbulanceDirection.TWO_WAY, + // groupValue: directionValue, + // onChanged: (AmbulanceDirection? newValue) { + // if (newValue != null) { + // context + // .read() + // .updateDirection(newValue); + // } + // }, + // activeColor: AppColors.primaryRedColor, + // fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), + // ), + // LocaleKeys.twoWay.tr(context: context) + // .toText14(color: AppColors.textColor, weight: FontWeight.w500) + // ], + // ).onPress(() { + // context + // + // .read() + // .updateDirection(AmbulanceDirection.TWO_WAY); + // }), + // ), + // ], + // ), + // ], + // ); + // }, + // ), ], - ); - }, + ), + ], ), + // Selector( + // selector: (context, viewModel) => viewModel.callingPlace, + // builder: (context, value, _) { + // return ; + // }, + // ), SizedBox( height: 16.h, ), - CustomButton( - text: LocaleKeys.confirm.tr(context: context), - onPressed: onTap, - backgroundColor: AppColors.primaryRedColor, - borderColor: AppColors.primaryRedColor, - textColor: AppColors.whiteColor, - iconColor: AppColors.whiteColor, - ), + // CustomButton( + // text: LocaleKeys.confirm.tr(context: context), + // onPressed: onTap, + // backgroundColor: AppColors.primaryRedColor, + // borderColor: AppColors.primaryRedColor, + // textColor: AppColors.whiteColor, + // iconColor: AppColors.whiteColor, + // ), ], ); } diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/transport_option_Item.dart b/lib/presentation/emergency_services/call_ambulance/widgets/transport_option_Item.dart index 9a959ebb..13c4c919 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/transport_option_Item.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/transport_option_Item.dart @@ -1,11 +1,14 @@ 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/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:provider/provider.dart'; class TransportOptionItem extends StatelessWidget { final String title; @@ -15,6 +18,7 @@ class TransportOptionItem extends StatelessWidget { final String lastIcon; final String price; final VoidCallback onTap; + final bool shouldFlipIcon; const TransportOptionItem( {super.key, @@ -24,6 +28,7 @@ class TransportOptionItem extends StatelessWidget { required this.middleIcon, required this.lastIcon, required this.price, + this.shouldFlipIcon = false, required this.onTap}); @override @@ -39,14 +44,14 @@ class TransportOptionItem extends StatelessWidget { spacing: 16.h, children: [ headerSection(), - titleSection(), + titleSection(context), ], )).onPress((){ onTap(); }); } - titleSection() { + titleSection(BuildContext context) { return Row( children: [ Expanded( @@ -55,13 +60,11 @@ class TransportOptionItem extends StatelessWidget { children: [ title.toText16( color: AppColors.textColor, weight: FontWeight.w600), - // subTitle.toText12( - // color: AppColors.greyTextColor, fontWeight: FontWeight.w500), + subTitle.toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500), ], ), ), - Utils.buildSvgWithAssets( - icon: AppAssets.forward_arrow_medium, width: 24.h, height: 24.h) + Transform.flip(flipX: getIt.get().isArabic(), child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_medium, width: 24.h, height: 24.h)) ], ); } @@ -70,20 +73,19 @@ class TransportOptionItem extends StatelessWidget { return Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - // Expanded( - // child: Row( - // children: [ - // buildIcon(firstIcon), - // Utils.buildSvgWithAssets( - // icon: middleIcon, width: 24.h, height: 24.h).paddingAll(8.h), - // buildIcon(lastIcon) - // ], - // ), - // ), - Utils.getPaymentAmountWithSymbol2( - num.tryParse(price) ?? 0.0, - fontSize: 18.f, - letterSpacing:-2 + Expanded( + child: Row( + children: [ + Transform.flip(flipX: getIt.get().isArabic() && shouldFlipIcon, child: buildIcon(firstIcon)), + // Utils.buildSvgWithAssets( + // icon: middleIcon, width: 24.h, height: 24.h).paddingAll(8.h), + // buildIcon(lastIcon) + ], + ), + ), + Visibility( + visible: price.isNotEmpty, + child: Utils.getPaymentAmountWithSymbol2(num.tryParse(price) ?? 0.0, fontSize: 18.f, letterSpacing: -2), ), ], ); @@ -98,7 +100,7 @@ class TransportOptionItem extends StatelessWidget { backgroundColor: AppColors.greyColor, iconColor: AppColors.greyTextColor, borderColor: Colors.transparent, - height: 40.h, + height: 42.h, ); } } diff --git a/lib/presentation/emergency_services/emergency_services_page.dart b/lib/presentation/emergency_services/emergency_services_page.dart index 801f6ca2..95546644 100644 --- a/lib/presentation/emergency_services/emergency_services_page.dart +++ b/lib/presentation/emergency_services/emergency_services_page.dart @@ -12,6 +12,7 @@ import 'package:hmg_patient_app_new/features/emergency_services/models/OrderDisp import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.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/widgets/WayPickup.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/ambulance_option_selection_bottomsheet.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart'; @@ -26,6 +27,8 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:lottie/lottie.dart'; import 'package:provider/provider.dart'; +import '../../features/emergency_services/models/AmbulanceCallingPlace.dart' show AmbulanceCallingPlace; + class EmergencyServicesPage extends StatefulWidget { EmergencyServicesPage({super.key}); @@ -440,7 +443,42 @@ class _EmergencyServicesPageState extends State { openTranportationSelectionBottomSheet(context); }), context, - child: PickupLocation(onTap: () { + child: PickupLocation(onTap: (fromLocation) { + Navigator.of(context).pop(); + if(fromLocation == AmbulanceCallingPlace.TO_HOSPITAL){ + openNumberWayOfSelectionBottomSheet(context); + return; + } + context.read().flushSearchPredictions(); + context.read().navigateTOAmbulancePage(); + }), + isFullScreen: false, + isCloseButtonVisible: true, + hasBottomPadding: false, + backgroundColor: AppColors.bottomSheetBgColor, + callBackFunc: () {}, + ); + } + + openNumberWayOfSelectionBottomSheet(BuildContext context) { + showCommonBottomSheetWithoutHeight( + onCloseClicked: () { + context.read().flushPickupInformation(); + }, + titleWidget: Transform.flip( + flipX: emergencyServicesViewModel.isArabic, + child: Utils.buildSvgWithAssets( + icon: AppAssets.arrow_back, + iconColor: Color(0xff2B353E), + fit: BoxFit.contain, + ), + ).onPress(() { + context.read().flushPickupInformation(); + Navigator.pop(context); + openPickupDetailsBottomSheet(context); + }), + context, + child: WayPickup(onTap: () { Navigator.of(context).pop(); context.read().flushSearchPredictions(); context.read().navigateTOAmbulancePage(); diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index c8cbf308..17e53ba7 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -8,7 +8,7 @@ class AppColors { static const transparent = Colors.transparent; // ── Scaffold / Background ───────────────────────────────────────────────── - static Color get scaffoldBgColor => isDarkMode ? dark.scaffoldBgColor : const Color(0xFFF0F0F0); + static Color get scaffoldBgColor => isDarkMode ? dark.scaffoldBgColor : const Color(0xFFF8F8F8); static Color get bottomSheetBgColor => isDarkMode ? dark.bottomSheetBgColor : const Color(0xFFF8F8FA); static Color get lightGreyEFColor => isDarkMode ? dark.lightGreyEFColor : const Color(0xffeaeaff); static Color get greyF7Color => isDarkMode ? dark.greyF7Color : const Color(0xffF7F7F7);