From e113c4c1ee61846de83bf0395131336c5581e03b Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Thu, 30 Oct 2025 14:23:46 +0300 Subject: [PATCH] updates & fixes & RRT Flow --- ios/Runner/AppDelegate.swift | 3 + lib/core/api_consts.dart | 2 +- lib/core/dependencies.dart | 6 +- .../authentication/authentication_repo.dart | 6 +- .../authentication_view_model.dart | 13 +- .../emergency_services_view_model.dart | 26 +- .../medical_file/medical_file_view_model.dart | 8 +- .../RRT/rrt_request_type_select.dart | 171 ++++++++++-- .../call_ambulance/call_ambulance_page.dart | 243 ++++++---------- .../requesting_services_page.dart | 17 +- .../call_ambulance/tracking_screen.dart | 261 ++++++++---------- .../emergency_services_page.dart | 154 ++++------- lib/presentation/my_family/my_family.dart | 2 +- lib/widgets/appbar/collapsing_list_view.dart | 1 + lib/widgets/common_bottom_sheet.dart | 81 +++--- .../ExpandableBottomSheet.dart | 2 +- lib/widgets/radio/custom_radio_button.dart | 26 +- 17 files changed, 507 insertions(+), 515 deletions(-) diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 69204f3..3d76a5f 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -2,6 +2,8 @@ import Flutter import UIKit import FirebaseCore import FirebaseMessaging +import GoogleMaps + @main @objc class AppDelegate: FlutterAppDelegate { @@ -10,6 +12,7 @@ import FirebaseMessaging didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { FirebaseApp.configure() + GMSServices.provideAPIKey("AIzaSyDiXnCO00li4V7Ioa2YZ_M4ECxRsu_P9tA") GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index ed2bba1..304b633 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -729,7 +729,7 @@ var GET_PRESCRIPTION_INSTRUCTIONS_PDF = 'Services/ChatBot_Service.svc/REST/Chatb class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index a82a9ad..7c8083d 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -158,7 +158,8 @@ class AppDependencies { ); getIt.registerLazySingleton( - () => BookAppointmentsViewModel(bookAppointmentsRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt(), myAppointmentsViewModel: getIt(), locationUtils: getIt(), dialogService: getIt()), + () => BookAppointmentsViewModel( + bookAppointmentsRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt(), myAppointmentsViewModel: getIt(), locationUtils: getIt(), dialogService: getIt()), ); getIt.registerLazySingleton( @@ -185,8 +186,7 @@ class AppDependencies { ); getIt.registerLazySingleton( - () => - AppointmentViaRegionViewmodel( + () => AppointmentViaRegionViewmodel( navigationService: getIt(), appState: getIt(), ), diff --git a/lib/features/authentication/authentication_repo.dart b/lib/features/authentication/authentication_repo.dart index d566996..6266afb 100644 --- a/lib/features/authentication/authentication_repo.dart +++ b/lib/features/authentication/authentication_repo.dart @@ -101,10 +101,7 @@ class AuthenticationRepoImp implements AuthenticationRepo { } @override - Future>> checkPatientAuthentication({ - required dynamic checkPatientAuthenticationReq, - String? languageID, - }) async { + Future>> checkPatientAuthentication({required dynamic checkPatientAuthenticationReq, String? languageID}) async { int isOutKsa = (checkPatientAuthenticationReq.zipCode == '966' || checkPatientAuthenticationReq.zipCode == '+966') ? 0 : 1; checkPatientAuthenticationReq.patientOutSA = isOutKsa; try { @@ -149,7 +146,6 @@ class AuthenticationRepoImp implements AuthenticationRepo { sendActivationCodeReq.isDentalAllowedBackend = false; final payload = sendActivationCodeReq.toJson(); if (isFormFamilyFile) { - payload.remove("MobileNo"); payload.remove("NationalID"); payload.remove("SMSSignature"); diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index 8be2b8e..6af1132 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -851,16 +851,13 @@ class AuthenticationViewModel extends ChangeNotifier { request['isRegister'] = true; _appState.setAppAuthToken = response['LogInTokenID']; if (isPatientOutsideSA(request: response)) { - print("=======OUT SA======="); sendActivationCode( - otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), - nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), - phoneNumber: request["PatientMobileNumber"].toString(), - payload: request, - isForRegister: true, - ); + otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), + nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), + phoneNumber: request["PatientMobileNumber"].toString(), + payload: request, + isForRegister: true); } else { - print("=======IN SA======="); chekUserNHICData(request: request); } } diff --git a/lib/features/emergency_services/emergency_services_view_model.dart b/lib/features/emergency_services/emergency_services_view_model.dart index 77e5823..5d02ca3 100644 --- a/lib/features/emergency_services/emergency_services_view_model.dart +++ b/lib/features/emergency_services/emergency_services_view_model.dart @@ -25,6 +25,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { final LocationUtils? locationUtils; final AppState appState; bool isERListLoading = false; + bool isTermsAccepted = false; List nearestERList = []; List nearestERFilteredList = []; @@ -47,11 +48,14 @@ class EmergencyServicesViewModel extends ChangeNotifier { required this.appState, }); - get isGMSAvailable - { + get isGMSAvailable { return appState.isGMSAvailable; } + void onTermAccepted() { + isTermsAccepted = !isTermsAccepted; + notifyListeners(); + } Future getRRTProcedures({Function(dynamic)? onSuccess, Function(String)? onError}) async { RRTProceduresList.clear(); @@ -89,6 +93,10 @@ class EmergencyServicesViewModel extends ChangeNotifier { }); } + void moveToNextStep() { + navServices.push(CustomPageRoute(page: CallAmbulancePage(isFromRRT: true))); + } + void filterErList(String query) { print("the query is $query"); if (query.isEmpty) { @@ -149,8 +157,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { } GMSMapServices.CameraPosition getGMSLocation() { - return GMSMapServices.CameraPosition( - target: GMSMapServices.LatLng(appState.userLat, appState.userLong), zoom: 18); + return GMSMapServices.CameraPosition(target: GMSMapServices.LatLng(appState.userLat, appState.userLong), zoom: 18); } handleGMSMapCameraMoved(GMSMapServices.CameraPosition value) { @@ -158,9 +165,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { } HMSCameraServices.CameraPosition getHMSLocation() { - return HMSCameraServices.CameraPosition( - target: HMSCameraServices.LatLng(appState.userLat, appState.userLong),zoom: 18); - + return HMSCameraServices.CameraPosition(target: HMSCameraServices.LatLng(appState.userLat, appState.userLong), zoom: 18); } handleHMSMapCameraMoved(HMSCameraServices.CameraPosition value) { @@ -173,11 +178,8 @@ class EmergencyServicesViewModel extends ChangeNotifier { onSuccess: (position) { updateBottomSheetState(BottomSheetType.FIXED); navServices.push( - CustomPageRoute( - page: CallAmbulancePage(), direction: AxisDirection.down - ), + CustomPageRoute(page: CallAmbulancePage(), direction: AxisDirection.down), ); - }); } @@ -187,8 +189,6 @@ class EmergencyServicesViewModel extends ChangeNotifier { } void setIsGMSAvailable(bool value) { - notifyListeners(); - } } diff --git a/lib/features/medical_file/medical_file_view_model.dart b/lib/features/medical_file/medical_file_view_model.dart index f0263f9..3e67a0e 100644 --- a/lib/features/medical_file/medical_file_view_model.dart +++ b/lib/features/medical_file/medical_file_view_model.dart @@ -59,7 +59,6 @@ class MedicalFileViewModel extends ChangeNotifier { _selectedFamilyFileTabIndex = value; notifyListeners(); } - } static final DialogService _dialogService = getIt.get(); @@ -486,6 +485,13 @@ class MedicalFileViewModel extends ChangeNotifier { }); } + Future clearAuthValues() async { + authVM.nationalIdController.clear(); + authVM.phoneNumberController.clear(); + authVM.emailController.clear(); + authVM.dobController.clear(); + } + Future handleFamilyFileRequestOTPVerification() async { LoaderBottomSheet.showLoader(); if (!_appState.getIsChildLoggedIn) { 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 0e23d49..fd93f8e 100644 --- a/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart +++ b/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart @@ -1,9 +1,18 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.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/core/dependencies.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/emergency_services/emergency_services_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/call_ambulance_page.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/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/radio/custom_radio_button.dart'; import 'package:provider/provider.dart'; @@ -13,32 +22,160 @@ class RrtRequestTypeSelect extends StatelessWidget { @override Widget build(BuildContext context) { // return Consumer(builder: (context, emergencyServicesVM, child) { + // NavigationService navService = getIt(); + // EmergencyServicesViewModel erServiceVm = Provider.of(context); return Column( children: [ + Padding( + padding: EdgeInsets.only(left: 24, right: 24, bottom: 24), + child: Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.r), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomRadioOption(value: "", groupValue: "", onChanged: (value) {}, text: "Home Visit Emergency".needTranslation).paddingSymmetrical(16, 24), + Divider(height: 1, color: Color(0xFFD2D2D2).withValues(alpha: 0.3)).paddingSymmetrical(16, 0), + CustomRadioOption(value: "", groupValue: "", onChanged: (value) {}, text: "COVID-19 (24 Hour) Home Visit".needTranslation).paddingSymmetrical(16, 24), + Divider(height: 1, color: Color(0xFFD2D2D2).withValues(alpha: 0.3)).paddingSymmetrical(16, 0), + CustomRadioOption(value: "", groupValue: "", onChanged: (value) {}, text: "COVID-19 (6 Hour) Home Visit".needTranslation).paddingSymmetrical(16, 24), + ], + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 24, right: 24, bottom: 24), + child: GestureDetector( + onTap: context.read().onTermAccepted, + child: Row( + children: [ + Selector( + selector: (_, vm) => vm.isTermsAccepted, + shouldRebuild: (previous, next) => previous != next, + builder: (context, isTermsAccepted, child) { + return AnimatedContainer( + duration: const Duration(milliseconds: 200), + height: 24.h, + width: 24.h, + decoration: BoxDecoration( + color: isTermsAccepted ? AppColors.primaryRedColor : Colors.transparent, + borderRadius: BorderRadius.circular(6), + border: Border.all(color: isTermsAccepted ? AppColors.primaryRedBorderColor : AppColors.greyColor, width: 2.h), + ), + child: isTermsAccepted ? Icon(Icons.check, size: 16.f, color: Colors.white) : null, + ); + }, + ), + SizedBox(width: 12.h), + Row( + children: [ + Text( + LocaleKeys.iAcceptThe.tr(), + style: context.dynamicTextStyle(fontSize: 14.f, fontWeight: FontWeight.w500, color: Color(0xFF2E3039)), + ), + GestureDetector( + onTap: () { + // Navigate to terms and conditions page + Navigator.of(context).pushNamed('/terms'); + }, + child: Text( + LocaleKeys.termsConditoins.tr(), + style: context.dynamicTextStyle( + fontSize: 14.f, fontWeight: FontWeight.w500, color: AppColors.primaryRedColor, decoration: TextDecoration.underline, decorationColor: AppColors.primaryRedBorderColor), + ), + ), + ], + ), + ], + ), + ), + ), Container( - padding: EdgeInsets.all(16.h), - height: 200.h, decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.h, + hasShadow: true, ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - CustomRadioOption( - value: "", - groupValue: "", - onChanged: (value) {}, - text: "Home Visit Emergency", - ) - ], - ), - ], + child: SizedBox( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // if (widget.patientAppointmentHistoryResponseModel.nextAction == 15 || widget.patientAppointmentHistoryResponseModel.nextAction == 20) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "Total amount to pay".needTranslation.toText18(isBold: true), + Utils.getPaymentAmountWithSymbol("1000".toString().toText16(isBold: true), AppColors.blackColor, 13, isSaudiCurrency: true), + ], + ), + SizedBox(height: 4.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: "Amount will be paid at the hospital".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor)), + "VAT 15%(${150})".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor, letterSpacing: -2), + ], + ), + SizedBox(height: 18.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + width: 150.h, + child: Utils.getPaymentMethods(), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Utils.getPaymentAmountWithSymbol("1,150".toString().toText24(isBold: true), AppColors.blackColor, 17, isSaudiCurrency: true), + ], + ), + ], + ) + ], + ).paddingOnly(left: 16.h, top: 24.h, right: 16.h, bottom: 0.h), + // AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel) + CustomButton( + text: LocaleKeys.next.tr(), + onPressed: () { + // navService.pop(); + context.read().moveToNextStep(); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16, + fontWeight: FontWeight.w500, + borderRadius: 12, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 50.h, + iconColor: AppColors.whiteColor, + iconSize: 18.h, + ).paddingSymmetrical(16.h, 24.h) + // : CustomButton( + // text: AppointmentType.getNextActionText(widget.patientAppointmentHistoryResponseModel.nextAction), + // onPressed: () { + // myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); + // handleAppointmentNextAction(widget.patientAppointmentHistoryResponseModel.nextAction); + // }, + // backgroundColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction), + // borderColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction).withOpacity(0.01), + // textColor: widget.patientAppointmentHistoryResponseModel.nextAction == 15 ? AppColors.textColor : AppColors.whiteColor, + // fontSize: 16, + // fontWeight: FontWeight.w500, + // borderRadius: 12, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 50.h, + // icon: AppointmentType.getNextActionIcon(widget.patientAppointmentHistoryResponseModel.nextAction), + // iconColor: AppColors.whiteColor, + // iconSize: 18.h, + // ).paddingSymmetrical(16.h, 24.h), + ], + ), ), ), - SizedBox(height: 32.h), ], ); // }); 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 eb36f92..63cb4e6 100644 --- a/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart +++ b/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:google_places_flutter/model/prediction.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/core/utils/utils.dart'; @@ -26,40 +27,38 @@ import 'package:provider/provider.dart'; import '../../../widgets/common_bottom_sheet.dart'; import 'widgets/AddressItem.dart'; -class CallAmbulancePage extends StatelessWidget { +class CallAmbulancePage extends StatefulWidget { + bool? isFromRRT; + + CallAmbulancePage({super.key, this.isFromRRT = false}); + + @override + State createState() => _CallAmbulancePageState(); +} + +class _CallAmbulancePageState extends State { + TextEditingController addressController = TextEditingController(); + @override Widget build(BuildContext context) { return Scaffold( bottomSheet: ExpandableBottomSheet( - bottomSheetType: - context.watch().bottomSheetType, + bottomSheetType: context.watch().bottomSheetType, children: { - BottomSheetType.EXPANDED: ExpanedBottomSheet(context), - BottomSheetType.FIXED: FixedBottomSheet(context), + BottomSheetType.EXPANDED: expandedBottomSheet(context), + BottomSheetType.FIXED: fixedBottomSheet(context), }, ), body: Stack( children: [ - if (context.read().isGMSAvailable || - Platform.isIOS) - GMSMap( - currentLocation: - context.read().getGMSLocation(), - onCameraMoved: (value) => context - .read() - .handleGMSMapCameraMoved(value)) + if (context.read().isGMSAvailable || Platform.isIOS) + GMSMap(currentLocation: context.read().getGMSLocation(), onCameraMoved: (value) => context.read().handleGMSMapCameraMoved(value)) else - HMSMap( - currentLocation: - context.read().getHMSLocation(), - onCameraMoved: (value) => context - .read() - .handleHMSMapCameraMoved(value)), + HMSMap(currentLocation: context.read().getHMSLocation(), onCameraMoved: (value) => context.read().handleHMSMapCameraMoved(value)), Align( alignment: AlignmentDirectional.topStart, - child: Utils.buildSvgWithAssets( - icon: AppAssets.closeBottomNav, width: 32.h, height: 32.h), - ).paddingOnly(top: 51.h, left: 24.h).onPress((){ + child: Utils.buildSvgWithAssets(icon: AppAssets.closeBottomNav, width: 32.h, height: 32.h), + ).paddingOnly(top: 51.h, left: 24.h).onPress(() { Navigator.pop(context); }) ], @@ -67,13 +66,12 @@ class CallAmbulancePage extends StatelessWidget { ); } - Widget FixedBottomSheet(BuildContext context) { + Widget fixedBottomSheet(BuildContext context) { return GestureDetector( - onVerticalDragUpdate: (details){ + onVerticalDragUpdate: (details) { print("the delta is ${details.delta.dy}"); - if(details.delta.dy<0){ - + if (details.delta.dy < 0) { context.read().updateBottomSheetState(BottomSheetType.EXPANDED); } }, @@ -84,15 +82,11 @@ class CallAmbulancePage extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Padding( - - padding: EdgeInsetsDirectional.only(end:24.h, bottom: 24.h), + Padding( + padding: EdgeInsetsDirectional.only(end: 24.h, bottom: 24.h), child: DecoratedBox( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, borderRadius: 12.h), - child: Utils.buildSvgWithAssets( - icon: AppAssets.locate_me, width: 24.h, height: 24.h) - .paddingAll(12.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.h), + child: Utils.buildSvgWithAssets(icon: AppAssets.locate_me, width: 24.h, height: 24.h).paddingAll(12.h), ), ), ], @@ -110,15 +104,15 @@ class CallAmbulancePage extends StatelessWidget { // ), // ), // ), - // .paddingOnly(right: 24.h, bottom: 24.h), + // .paddingOnly(right: 24.h, bottom: 24.h), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, spacing: 24.h, children: [ TextInputWidget( - labelText: "Enter Pickup Location Manually".needTranslation, - hintText: "Enter Pickup Location".needTranslation, + labelText: widget.isFromRRT! ? "Type Address".needTranslation : "Enter Pickup Location Manually".needTranslation, + hintText: widget.isFromRRT! ? "Enter street or area name".needTranslation : "Enter Pickup Location".needTranslation, leadingIcon: AppAssets.location_pickup, isAllowLeadingIcon: true, isEnable: false, @@ -126,50 +120,27 @@ class CallAmbulancePage extends StatelessWidget { autoFocus: false, isBorderAllowed: false, keyboardType: TextInputType.text, - padding: EdgeInsets.symmetric( - vertical: ResponsiveExtension(10).h, - horizontal: ResponsiveExtension(15).h, - ), - ).onPress(() { - context - .read() - .updateBottomSheetState(BottomSheetType.EXPANDED); - }).paddingOnly(right: 24.h, left: 24.h), + controller: addressController, + padding: EdgeInsets.symmetric(vertical: ResponsiveExtension(8).h, horizontal: ResponsiveExtension(12).h), + ).paddingOnly(right: 24.h, left: 24.h), SizedBox( height: 200.h, child: DecoratedBox( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.scaffoldBgColor, - customBorder: BorderRadius.only( - topLeft: Radius.circular(24.h), - topRight: Radius.circular(24.h), - ), + customBorder: BorderRadius.only(topLeft: Radius.circular(24.h), topRight: Radius.circular(24.h)), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - spacing: 24.h, + spacing: 4, children: [ - Column( - spacing: 4.h, - children: [ - "Select Pickup Location".needTranslation.toText21( - weight: FontWeight.w600, - color: AppColors.textColor, - ), - " Please select the location of pickup" - .needTranslation - .toText12( - fontWeight: FontWeight.w500, - color: AppColors.greyTextColor, - ) - ], - ), + "Select Pickup Location".needTranslation.toText21(weight: FontWeight.w600, color: AppColors.textColor), + " Please select the location of pickup".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), + SizedBox(height: 20.h), CustomButton( text: "Select Location".needTranslation, onPressed: () { - context - .read() - .updateBottomSheetState(BottomSheetType.EXPANDED); + context.read().updateBottomSheetState(BottomSheetType.EXPANDED); }) ], ).paddingOnly(top: 24.h, bottom: 32.h, left: 24.h, right: 24.h), @@ -182,23 +153,20 @@ class CallAmbulancePage extends StatelessWidget { ); } - Widget ExpanedBottomSheet(BuildContext context) { + Widget expandedBottomSheet(BuildContext context) { return GestureDetector( - onVerticalDragUpdate: (details){ - if(details.delta.dy>0){ - context.read().updateBottomSheetState(BottomSheetType.FIXED); - } - }, + onVerticalDragUpdate: (details) { + if (details.delta.dy > 0) { + context.read().updateBottomSheetState(BottomSheetType.FIXED); + } + }, child: Column( mainAxisSize: MainAxisSize.min, children: [ DecoratedBox( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.scaffoldBgColor, - customBorder: BorderRadius.only( - topLeft: Radius.circular(24.h), - topRight: Radius.circular(24.h), - ), + customBorder: BorderRadius.only(topLeft: Radius.circular(24.h), topRight: Radius.circular(24.h)), ), child: Column( children: [ @@ -207,17 +175,12 @@ class CallAmbulancePage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 16.h, children: [ - "Select Pickup Location".needTranslation.toText21( - weight: FontWeight.w600, - color: AppColors.textColor, - ), + "Select Pickup Location".needTranslation.toText21(weight: FontWeight.w600, color: AppColors.textColor), locationsSections(context), - hospitalAndPickUpSection(context), - + widget.isFromRRT! ? SizedBox() : hospitalAndPickUpSection(context), ], - ).paddingOnly(top: 24.h, bottom: 32.h,left: 24.h, right: 24.h), + ).paddingOnly(top: 24.h, bottom: 32.h, left: 24.h, right: 24.h), ), - bottomPriceContent(context) ], ), @@ -249,8 +212,7 @@ class CallAmbulancePage extends StatelessWidget { shrinkWrap: true, itemCount: 3, itemBuilder: (__, index) { - if (index == - 2) // todo means the end of the list so handle as per the viewmodel + if (index == 2) // todo means the end of the list so handle as per the viewmodel { return CustomButton( height: 40.h, @@ -264,11 +226,8 @@ class CallAmbulancePage extends StatelessWidget { } else { return AddressItem( isSelected: index == 0, - address: - "Flat No 301, Building No 12, Palm Spring Apartment, Sector 45, Gurugram, Haryana 122003", - title: index == 0 - ? "Home".needTranslation - : "Work".needTranslation, + address: "Flat No 301, Building No 12, Palm Spring Apartment, Sector 45, Gurugram, Haryana 122003", + title: index == 0 ? "Home".needTranslation : "Work".needTranslation, onTap: () {}, ); } @@ -293,11 +252,9 @@ class CallAmbulancePage extends StatelessWidget { subTitle: "hospital".needTranslation, leadingIcon: AppAssets.hospital, ), - Utils.buildSvgWithAssets(icon: AppAssets.down_cheveron, - width: 24.h, height: 24.h) - .paddingAll(16.h) + Utils.buildSvgWithAssets(icon: AppAssets.down_cheveron, width: 24.h, height: 24.h).paddingAll(16.h) ], - ).onPress((){ + ).onPress(() { showHospitalBottomSheet(context); }), SizedBox(height: 16.h), @@ -307,7 +264,6 @@ class CallAmbulancePage extends StatelessWidget { thickness: 1, ), SizedBox(height: 16.h), - Row( children: [ hospitalAndPickUpItemContent( @@ -317,8 +273,8 @@ class CallAmbulancePage extends StatelessWidget { ), CustomSwitch( value: context.watch().isGMSAvailable, - onChanged: (value){ - context.read().setIsGMSAvailable( value); + onChanged: (value) { + context.read().setIsGMSAvailable(value); }, ) ], @@ -378,68 +334,49 @@ class CallAmbulancePage extends StatelessWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.end, children: [ - DecoratedBox( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.scaffoldBgColor, - customBorder: BorderRadius.only( - topLeft: Radius.circular(24.h), - topRight: Radius.circular(24.h), - ), - hasShadow: true - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - spacing: 12.h, + DecoratedBox( + decoration: RoundedRectangleBorder() + .toSmoothCornerDecoration(color: AppColors.scaffoldBgColor, customBorder: BorderRadius.only(topLeft: Radius.circular(24.h), topRight: Radius.circular(24.h)), hasShadow: true), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 12.h, + children: [ + Row( children: [ - Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - spacing: 4.h, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 4.h, + children: [ + "Total amount to pay".needTranslation.toText18(weight: FontWeight.w600, color: AppColors.textColor), + Row( children: [ - "Total amount to pay".needTranslation.toText18( - weight: FontWeight.w600, - color: AppColors.textColor, - ), - Row( - children: [ - Utils.buildSvgWithAssets(icon: AppAssets.warning, - height: 18.h, width: 18.h), - SizedBox(width: 4.h,), - "Amount will be paid at the hospital" - .needTranslation - .toText12( - fontWeight: FontWeight.w500, - color: AppColors.greyTextColor, - ), - ], - ) + Utils.buildSvgWithAssets(icon: AppAssets.warning, height: 18.h, width: 18.h), + SizedBox(width: 4.h), + "Amount will be paid at the hospital".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), ], - ), - ), - "\$250".toText24( - fontWeight: FontWeight.w600, - color: AppColors.textColor, - ) - ], + ) + ], + ), ), - CustomButton( - text: "Submit Request".needTranslation, - onPressed: () { - Navigator.push(context, CustomPageRoute(page: RequestingServicesPage())); - }) + Utils.getPaymentAmountWithSymbol("250".toString().toText24(isBold: true), AppColors.blackColor, 17, isSaudiCurrency: true), ], - ).paddingOnly(top: 24.h, bottom: 12.h, left: 24.h, right: 24.h), - ), + ), + CustomButton( + text: "Submit Request".needTranslation, + onPressed: () { + Navigator.push(context, CustomPageRoute(page: RequestingServicesPage())); + }) + ], + ).paddingOnly(top: 24.h, bottom: 24.h, left: 24.h, right: 24.h), + ), ], ); } - showHospitalBottomSheet(BuildContext context){ + showHospitalBottomSheet(BuildContext context) { showCommonBottomSheetWithoutHeight( - title: - LocaleKeys.selectHospital.tr(), + title: LocaleKeys.selectHospital.tr(), context, child: HospitalBottomSheetBody(), isFullScreen: false, diff --git a/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart b/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart index 7f79be0..10c139c 100644 --- a/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart +++ b/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart @@ -7,11 +7,12 @@ 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/presentation/emergency_services/call_ambulance/tracking_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; -import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart' - show CustomPageRoute; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart' show CustomPageRoute; import 'package:lottie/lottie.dart'; class RequestingServicesPage extends StatefulWidget { + RequestingServicesPage({super.key}); + @override State createState() => _RequestingServicesPageState(); } @@ -20,8 +21,7 @@ class _RequestingServicesPageState extends State { @override void initState() { Timer(Duration(seconds: 3), () { - Navigator.pushReplacement( - context, CustomPageRoute(page: TrackingScreen())); + Navigator.pushReplacement(context, CustomPageRoute(page: TrackingScreen())); }); super.initState(); } @@ -32,14 +32,7 @@ class _RequestingServicesPageState extends State { color: AppColors.scaffoldBgColor, child: Stack( children: [ - Lottie.asset(AppAnimations.loadingAnimation, - width: 80.h, - height: 80.h, - repeat: true, - reverse: false, - frameRate: FrameRate(60), - fit: BoxFit.fill) - .center, + Lottie.asset(AppAnimations.loadingAnimation, width: 80.h, height: 80.h, repeat: true, reverse: false, frameRate: FrameRate(60), fit: BoxFit.fill).center, Positioned( bottom: 1, child: "Submitting your request. \nPlease wait for a moment" diff --git a/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart b/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart index a48ca10..483da07 100644 --- a/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart +++ b/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart @@ -20,38 +20,37 @@ import 'package:lottie/lottie.dart'; import 'package:provider/provider.dart'; class TrackingScreen extends StatelessWidget { - final OrderTrackingState state = OrderTrackingState.ended; + final OrderTrackingState state = OrderTrackingState.waitingForCall; + @override Widget build(BuildContext context) { - return Scaffold( - bottomNavigationBar: Visibility( - visible: state == OrderTrackingState.ended, - child: SafeArea( - child: CustomButton( - height: 56.h, - backgroundColor: AppColors.bgGreenColor, - borderColor: Colors.transparent, - text: "Close".needTranslation, - textColor: AppColors.whiteColor, - onPressed: () {}, - ).paddingOnly(left:16.h,right:16.h), - ), + return CollapsingListView( + title: "Tracking Details".needTranslation, + bottomChild: Visibility( + visible: state == OrderTrackingState.ended, + child: CustomButton( + height: 50.h, + backgroundColor: AppColors.bgGreenColor, + borderColor: Colors.transparent, + text: "Close".needTranslation, + textColor: AppColors.whiteColor, + onPressed: () {}, + ).paddingOnly(left: 16.h, right: 16.h, bottom: 16.h), ), - body: CollapsingListView( - title: "Tracking Details".needTranslation, - child: SingleChildScrollView( - child: Column( - children: [ - animationSection(), - Column( - spacing: 16.h, - children: [OrderStatus(context), OrderTrackingId(), ContactSection()], - ).paddingAll(16.h), - ], - ))), + child: SingleChildScrollView( + child: Column( + children: [ + animationSection(), + Column( + spacing: 16.h, + children: [OrderStatus(context), OrderTrackingId(), ContactSection()], + ).paddingAll(16.h), + ], + )), ); } - animationSection(){ + + animationSection() { switch (state) { case OrderTrackingState.waitingForCall: case OrderTrackingState.dispactched: @@ -59,18 +58,14 @@ class TrackingScreen extends StatelessWidget { return Lottie.asset(AppAnimations.ambulance, repeat: true, reverse: false, width: 260.h, height: 200.h); case OrderTrackingState.ended: default: - return Lottie.asset(AppAnimations.checkmark, repeat: true, width: 260.h, height: 200.h); + return Lottie.asset(AppAnimations.checkmark, repeat: true, width: 260.h, height: 200.h); } } OrderStatus(BuildContext context) { return Container( padding: EdgeInsets.all(16.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.h, - hasShadow: false, - ), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: false), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -95,7 +90,7 @@ class TrackingScreen extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 16,), + SizedBox(height: 16.h), CustomButton( text: "Cancel Request".needTranslation, onPressed: () async {}, @@ -119,7 +114,7 @@ class TrackingScreen extends StatelessWidget { backgroundColor: AppColors.lightRedButtonColor, borderColor: Colors.transparent, text: "Share Your Live Locatin on Whatsapp".needTranslation, - fontSize: 12.fSize, + fontSize: 12.f, textColor: AppColors.primaryRedColor, iconColor: AppColors.primaryRedColor, onPressed: () {}, @@ -131,11 +126,7 @@ class TrackingScreen extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, spacing: 12.h, - children: [ - dividerSection, - doctorSection(), - mapSection(context) - ], + children: [dividerSection, doctorSection(), mapSection(context)], ); case OrderTrackingState.ended: default: @@ -170,17 +161,14 @@ class TrackingScreen extends StatelessWidget { return Row( spacing: 16.h, children: [ - Utils.buildImgWithNetwork(url: "", iconColor: Colors.transparent) - .circle(52.h), + Utils.buildImgWithNetwork(url: "", iconColor: Colors.transparent).circle(52.h), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Dr. John Doe".toText16( - color: AppColors.textColor, weight: FontWeight.w600), + "Dr. John Doe".toText16(color: AppColors.textColor, weight: FontWeight.w600), SizedBox(height: 4.h), - "MBBS, MD - General Medicine".toText12( - color: AppColors.greyTextColor, fontWeight: FontWeight.w500), + "MBBS, MD - General Medicine".toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500), ], ), ), @@ -204,96 +192,83 @@ class TrackingScreen extends StatelessWidget { Widget mapForRequestedCoordinate(BuildContext context) { // return SizedBox.shrink(); - if (context.read().isGMSAvailable || - Platform.isIOS) - return GMSMap( - myLocationEnabled: false, - currentLocation: - context.read().getGMSLocation(), - onCameraMoved: (value) => context - .read() - .handleGMSMapCameraMoved(value)); - else + if (context.read().isGMSAvailable || Platform.isIOS) { + return GMSMap( + myLocationEnabled: false, + currentLocation: context.read().getGMSLocation(), + onCameraMoved: (value) => context.read().handleGMSMapCameraMoved(value)); + } else { return HMSMap( myLocationEnabled: false, - currentLocation: - context.read().getHMSLocation(), - onCameraMoved: (value) => context - .read() - .handleHMSMapCameraMoved(value)); + currentLocation: context.read().getHMSLocation(), + onCameraMoved: (value) => context.read().handleHMSMapCameraMoved(value)); + } } informationRegardingTrackingSection() { return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - currentStatus(), - SizedBox(height: 4.h), - "You will receive a call from HMG for confirmation ".toText12( - color: AppColors.greyTextColor, fontWeight: FontWeight.w500) - ], + children: [currentStatus(), SizedBox(height: 4.h), "You will receive a call from HMG for confirmation ".toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500)], ); } currentStatus() { - switch (state) { - case OrderTrackingState.waitingForCall: - case OrderTrackingState.dispactched: - return RichText( - text: TextSpan(children: [ - TextSpan( - text: "Please wait for the call".needTranslation, - style: TextStyle( - fontSize: 21.fSize, - fontWeight: FontWeight.w600, - color: AppColors.textColor, - ), - ), - TextSpan( - text: "...".needTranslation, - style: TextStyle( - fontSize: 21.fSize, - fontWeight: FontWeight.w600, - color: AppColors.errorColor, - ), - ), - ]), - ); - case OrderTrackingState.returning: - return RichText( - text: TextSpan(children: [ - TextSpan( - text: "15:30".needTranslation, - style: TextStyle( - fontSize: 21.fSize, - fontWeight: FontWeight.w600, - color: AppColors.textColor, - ), - ), - TextSpan( - text: " mins ".needTranslation, - style: TextStyle( - fontSize: 21.fSize, - fontWeight: FontWeight.w600, - color: AppColors.errorColor, - ), - ), - TextSpan( - text: "to hospital".needTranslation, - style: TextStyle( - fontSize: 21.fSize, - fontWeight: FontWeight.w600, - color: AppColors.textColor, - ), - ), - ]), - ); - case OrderTrackingState.ended: - default: - return "Arrived" - .needTranslation - .toText21(color: AppColors.textColor, weight: FontWeight.w600); - } + switch (state) { + case OrderTrackingState.waitingForCall: + case OrderTrackingState.dispactched: + return RichText( + text: TextSpan(children: [ + TextSpan( + text: "Please wait for the call".needTranslation, + style: TextStyle( + fontSize: 21.f, + fontWeight: FontWeight.w600, + color: AppColors.textColor, + ), + ), + TextSpan( + text: "...".needTranslation, + style: TextStyle( + fontSize: 21.f, + fontWeight: FontWeight.w600, + color: AppColors.errorColor, + ), + ), + ]), + ); + case OrderTrackingState.returning: + return RichText( + text: TextSpan(children: [ + TextSpan( + text: "15:30".needTranslation, + style: TextStyle( + fontSize: 21.f, + fontWeight: FontWeight.w600, + color: AppColors.textColor, + ), + ), + TextSpan( + text: " mins ".needTranslation, + style: TextStyle( + fontSize: 21.f, + fontWeight: FontWeight.w600, + color: AppColors.errorColor, + ), + ), + TextSpan( + text: "to hospital".needTranslation, + style: TextStyle( + fontSize: 21.f, + fontWeight: FontWeight.w600, + color: AppColors.textColor, + ), + ), + ]), + ); + case OrderTrackingState.ended: + default: + return "Arrived".needTranslation.toText21(color: AppColors.textColor, weight: FontWeight.w600); + } } OrderTrackingId() { @@ -308,19 +283,15 @@ class TrackingScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 8.h, children: [ - "Req ID:1234567890" - .toText16(color: AppColors.textColor, weight: FontWeight.w600), + "Req ID:1234567890".toText16(color: AppColors.textColor, weight: FontWeight.w600), Row( spacing: 8.h, children: [ - Chip("location name".needTranslation, AppAssets.location_pickup, - AppColors.blackBgColor), - Chip("hotel name ".needTranslation, AppAssets.hospital, - AppColors.blackBgColor), + Chip("location name".needTranslation, AppAssets.location_pickup, AppColors.blackBgColor), + Chip("hotel name ".needTranslation, AppAssets.hospital, AppColors.blackBgColor), ], ), - Chip("hotel name ".needTranslation, AppAssets.hospital, - AppColors.blackBgColor), + Chip("hotel name ".needTranslation, AppAssets.hospital, AppColors.blackBgColor), ], ), ); @@ -350,11 +321,8 @@ class TrackingScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 4.h, children: [ - "Contact Rapid Response Team (RRT)".needTranslation.toText14( - color: AppColors.textColor, weight: FontWeight.w600), - "1223456789".needTranslation.toText12( - color: AppColors.primaryRedColor, - fontWeight: FontWeight.w500), + "Contact Rapid Response Team (RRT)".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w600), + "1223456789".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), SizedBox(height: 8.h), ], ), @@ -390,27 +358,22 @@ class TrackingScreen extends StatelessWidget { getTitle(OrderTrackingState state) { switch (state) { case OrderTrackingState.waitingForCall: - return "Confirmation Call".needTranslation - .toText16(color: AppColors.textColor, weight: FontWeight.w600); + return "Confirmation Call".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); case OrderTrackingState.dispactched: - return "Pickup Up from Home".needTranslation - .toText16(color: AppColors.textColor, weight: FontWeight.w600); + return "Pickup Up from Home".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); case OrderTrackingState.returning: - return " On The Way To Hospital".needTranslation - .toText16(color: AppColors.textColor, weight: FontWeight.w600); + return " On The Way To Hospital".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); case OrderTrackingState.ended: default: - return "Arrived at Hospital".needTranslation - .toText16(color: AppColors.textColor, weight: FontWeight.w600); + return "Arrived at Hospital".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); } } mapSection(BuildContext context) { - return SizedBox( + return SizedBox( height: 170.h, width: double.infinity, - child: ClipRRect( - borderRadius: BorderRadius.circular(20.h),child: mapForRequestedCoordinate(context)), + child: ClipRRect(borderRadius: BorderRadius.circular(20.h), child: mapForRequestedCoordinate(context)), ); } } diff --git a/lib/presentation/emergency_services/emergency_services_page.dart b/lib/presentation/emergency_services/emergency_services_page.dart index ddea6fd..cf7c4dc 100644 --- a/lib/presentation/emergency_services/emergency_services_page.dart +++ b/lib/presentation/emergency_services/emergency_services_page.dart @@ -67,8 +67,7 @@ class EmergencyServicesPage extends StatelessWidget { showCommonBottomSheetWithoutHeight( context, child: Container( - decoration: - RoundedRectangleBorder().toSmoothCornerDecoration( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.primaryRedColor, borderRadius: 24.h, ), @@ -92,22 +91,11 @@ class EmergencyServicesPage extends StatelessWidget { }), ], ), - Lottie.asset(AppAnimations.ambulance_alert, - repeat: false, - reverse: false, - frameRate: FrameRate(60), - width: 120.h, - height: 120.h, - fit: BoxFit.contain), + Lottie.asset(AppAnimations.ambulance_alert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain), SizedBox(height: 8.h), - "Confirmation".needTranslation.toText28( - color: AppColors.whiteColor, isBold: true), + "Confirmation".needTranslation.toText28(color: AppColors.whiteColor, isBold: true), SizedBox(height: 8.h), - "Are you sure you want to call an ambulance?" - .needTranslation - .toText14( - color: AppColors.whiteColor, - weight: FontWeight.w500), + "Are you sure you want to call an ambulance?".needTranslation.toText14(color: AppColors.whiteColor, weight: FontWeight.w500), SizedBox(height: 24.h), CustomButton( text: LocaleKeys.confirm.tr(context: context), @@ -115,15 +103,11 @@ class EmergencyServicesPage extends StatelessWidget { // Navigator.of(context).pop(); showCommonBottomSheetWithoutHeight( - title: - "Transport Options".needTranslation, + title: "Transport Options".needTranslation, context, - child: AmbulanceOptionSelectionBottomSheet( - onTap: () { + child: AmbulanceOptionSelectionBottomSheet(onTap: () { Navigator.of(context).pop(); - context - .read() - .navigateTOAmbulancePage(); + context.read().navigateTOAmbulancePage(); }), isFullScreen: false, isCloseButtonVisible: true, @@ -182,11 +166,7 @@ class EmergencyServicesPage extends StatelessWidget { SizedBox(height: 16.h), Container( padding: EdgeInsets.all(16.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.h, - hasShadow: false, - ), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: false), child: Row( children: [ Utils.buildSvgWithAssets(icon: AppAssets.rrt_icon, width: 40.h, height: 40.h), @@ -195,8 +175,8 @@ class EmergencyServicesPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Rapid Response Team (RRT)".toText16(isBold: true, color: AppColors.blackColor), - "Comprehensive medical service for all sorts of urgent and stable cases".toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500), + "Rapid Response Team (RRT)".needTranslation.toText16(isBold: true, color: AppColors.blackColor), + "Comprehensive medical service for all sorts of urgent and stable cases".needTranslation.toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500), ], ), ), @@ -204,71 +184,57 @@ class EmergencyServicesPage extends StatelessWidget { Utils.buildSvgWithAssets(icon: AppAssets.forward_chevron_icon, width: 13.h, height: 13.h), ], ).onPress(() { - showCommonBottomSheetWithoutHeight( - context, - child: Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.primaryRedColor, - borderRadius: 24.h, - ), - child: Padding( - padding: EdgeInsets.all(24.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - "".toText14(), - Utils.buildSvgWithAssets( - icon: AppAssets.cancel_circle_icon, - iconColor: AppColors.whiteColor, - width: 24.h, - height: 24.h, - fit: BoxFit.contain, - ).onPress(() { + locationUtils!.getLocation( + isShowConfirmDialog: true, + onSuccess: (position) { + showCommonBottomSheetWithoutHeight( + context, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Lottie.asset(AppAnimations.ambulance_alert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.contain), + SizedBox(height: 8.h), + "Confirmation".needTranslation.toText28( + color: AppColors.whiteColor, + isBold: true, + ), + SizedBox(height: 8.h), + "Are you sure you want to call Rapid Response Team (RRT)?".needTranslation.toText16(color: AppColors.whiteColor, weight: FontWeight.w500), + SizedBox(height: 24.h), + CustomButton( + text: LocaleKeys.confirm.tr(context: context), + onPressed: () async { Navigator.of(context).pop(); - }), - ], - ), - Lottie.asset(AppAnimations.ambulance_alert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain), - SizedBox(height: 8.h), - "Confirmation".needTranslation.toText28(color: AppColors.whiteColor, isBold: true), - SizedBox(height: 8.h), - "Are you sure you want to call Rapid Response Team (RRT)?".needTranslation.toText14(color: AppColors.whiteColor, weight: FontWeight.w500), - SizedBox(height: 24.h), - CustomButton( - text: LocaleKeys.confirm.tr(context: context), - onPressed: () async { - Navigator.of(context).pop(); - showCommonBottomSheetWithoutHeight( - title: "Rapid Response Team (RRT)".needTranslation, - context, - child: RrtRequestTypeSelect(), - isFullScreen: false, - isCloseButtonVisible: true, - hasBottomPadding: false, - backgroundColor: AppColors.bottomSheetBgColor, - callBackFunc: () {}, - ); - }, - backgroundColor: AppColors.whiteColor, - borderColor: AppColors.whiteColor, - textColor: AppColors.primaryRedColor, - icon: AppAssets.checkmark_icon, - iconColor: AppColors.primaryRedColor, - ), - SizedBox(height: 8.h), - ], - ), - ), - ), - isFullScreen: false, - isCloseButtonVisible: false, - hasBottomPadding: false, - backgroundColor: AppColors.primaryRedColor, - callBackFunc: () {}, - ); + showCommonBottomSheetWithoutHeight( + title: "Rapid Response Team (RRT)".needTranslation, + context, + child: RrtRequestTypeSelect(), + isFullScreen: false, + isCloseButtonVisible: true, + hasBottomPadding: false, + isDisablePadding: true, + backgroundColor: AppColors.bottomSheetBgColor, + callBackFunc: () {}, + ); + }, + backgroundColor: AppColors.whiteColor, + borderColor: AppColors.whiteColor, + textColor: AppColors.primaryRedColor, + icon: AppAssets.checkmark_icon, + iconColor: AppColors.primaryRedColor, + ), + SizedBox(height: 20.h), + ], + ), + isFullScreen: false, + isCloseButtonVisible: true, + hasBottomPadding: false, + backgroundColor: AppColors.primaryRedColor, + iconColor: Colors.white, + customCloseIcon: AppAssets.cancel_circle_icon, + callBackFunc: () {}, + ); + }); }), ), ], diff --git a/lib/presentation/my_family/my_family.dart b/lib/presentation/my_family/my_family.dart index 194d5e0..781624a 100644 --- a/lib/presentation/my_family/my_family.dart +++ b/lib/presentation/my_family/my_family.dart @@ -50,7 +50,6 @@ class _FamilyMedicalScreenState extends State { medicalVM?.onFamilyFileTabChange(0); }); } - @override Widget build(BuildContext context) { @@ -69,6 +68,7 @@ class _FamilyMedicalScreenState extends State { text: "Add a new family member".needTranslation, onPressed: () { DialogService dialogService = getIt.get(); + medicalVM!.clearAuthValues(); dialogService.showAddFamilyFileSheet( label: "Add Family Member".needTranslation, message: "Please fill the below field to add a new family member to your profile".needTranslation, diff --git a/lib/widgets/appbar/collapsing_list_view.dart b/lib/widgets/appbar/collapsing_list_view.dart index 1574a0a..fc70d03 100644 --- a/lib/widgets/appbar/collapsing_list_view.dart +++ b/lib/widgets/appbar/collapsing_list_view.dart @@ -54,6 +54,7 @@ class CollapsingListView extends StatelessWidget { SliverAppBar( automaticallyImplyLeading: false, pinned: true, + expandedHeight: 100.h, stretch: true, systemOverlayStyle: SystemUiOverlayStyle(statusBarBrightness: Brightness.light), diff --git a/lib/widgets/common_bottom_sheet.dart b/lib/widgets/common_bottom_sheet.dart index 4d0dcf1..7d7bef7 100644 --- a/lib/widgets/common_bottom_sheet.dart +++ b/lib/widgets/common_bottom_sheet.dart @@ -105,17 +105,20 @@ class ButtonSheetContent extends StatelessWidget { } void showCommonBottomSheetWithoutHeight( - BuildContext context, { - required Widget child, - required VoidCallback callBackFunc, - String title = "", - bool isCloseButtonVisible = true, - bool isFullScreen = true, - bool isDismissible = true, - Widget? titleWidget, - bool useSafeArea = false, + BuildContext context, { + required Widget child, + required VoidCallback callBackFunc, + String title = "", + bool isCloseButtonVisible = true, + bool isFullScreen = true, + bool isDismissible = true, + Widget? titleWidget, + bool useSafeArea = false, bool hasBottomPadding = true, Color backgroundColor = AppColors.bottomSheetBgColor, + Color iconColor = const Color(0xff2B353E), + String? customCloseIcon, + bool isDisablePadding = false, }) { showModalBottomSheet( sheetAnimationStyle: AnimationStyle( @@ -145,40 +148,32 @@ void showCommonBottomSheetWithoutHeight( physics: ClampingScrollPhysics(), child: isCloseButtonVisible ? Container( - padding: EdgeInsets.only( - left: 24, - top: 24, - right: 24, - bottom: 12, - ), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.bottomSheetBgColor, - borderRadius: 24.h, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - titleWidget ?? - Expanded( - child: title.toText20(weight: FontWeight.w600), - ), - Utils.buildSvgWithAssets( - icon: AppAssets.close_bottom_sheet_icon, - iconColor: Color(0xff2B353E), - ).onPress(() { - Navigator.of(context).pop(); - }), - ], - ), - SizedBox(height: 16.h), - child, - ], - ), - ) + padding: isDisablePadding ? null : EdgeInsets.only(left: 24, top: 24, right: 24, bottom: 12), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: backgroundColor, borderRadius: 24.h), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + titleWidget ?? + Expanded( + child: title.toText20(weight: FontWeight.w600), + ), + Utils.buildSvgWithAssets( + icon: customCloseIcon ?? AppAssets.close_bottom_sheet_icon, + iconColor: iconColor, + ).onPress(() { + Navigator.of(context).pop(); + }), + ], + ).paddingOnly(left: isDisablePadding ? 24 : 0, right: isDisablePadding ? 24 : 0, bottom: isDisablePadding ? 12 : 0, top: isDisablePadding ? 24 : 0), + SizedBox(height: 16.h), + child, + ], + ), + ) : child, ), ), diff --git a/lib/widgets/expandable_bottom_sheet/ExpandableBottomSheet.dart b/lib/widgets/expandable_bottom_sheet/ExpandableBottomSheet.dart index 73a4a47..b18bd58 100644 --- a/lib/widgets/expandable_bottom_sheet/ExpandableBottomSheet.dart +++ b/lib/widgets/expandable_bottom_sheet/ExpandableBottomSheet.dart @@ -10,7 +10,7 @@ class ExpandableBottomSheet extends StatelessWidget { @override Widget build(BuildContext context) { - print("the currently selected item is ${bottomSheetType}"); + print("the currently selected item is $bottomSheetType"); return AnimatedCrossFade( duration: const Duration(milliseconds: 600), firstChild:children[BottomSheetType.FIXED] ?? SizedBox.shrink(), diff --git a/lib/widgets/radio/custom_radio_button.dart b/lib/widgets/radio/custom_radio_button.dart index 080fcb3..a530102 100644 --- a/lib/widgets/radio/custom_radio_button.dart +++ b/lib/widgets/radio/custom_radio_button.dart @@ -11,14 +11,13 @@ class CustomRadioOption extends StatelessWidget { // final Widget child; // The content of your radio option (e.g., Text, Image) - const CustomRadioOption({ - super.key, - required this.value, - required this.groupValue, - required this.onChanged, - // required this.child, - required this.text, - }); + const CustomRadioOption( + {super.key, + required this.value, + required this.groupValue, + required this.onChanged, + // required this.child, + required this.text}); @override Widget build(BuildContext context) { @@ -31,13 +30,12 @@ class CustomRadioOption extends StatelessWidget { child: Row( children: [ Container( - width: 20.h, - height: 20.h, + width: 18.h, + height: 18.h, decoration: BoxDecoration( - shape: BoxShape.circle, - color: isSelected ? AppColors.primaryRedColor : AppColors.whiteColor, - border: Border.all(color: isSelected ? AppColors.primaryRedColor : AppColors.bottomNAVBorder, width: 2.h), - ), + shape: BoxShape.circle, + color: isSelected ? AppColors.primaryRedColor : AppColors.whiteColor, + border: Border.all(color: isSelected ? AppColors.primaryRedColor : AppColors.bottomNAVBorder, width: 2.h)), ), SizedBox(width: 8.h), text.toText16(weight: FontWeight.w500), // The provided content