@ -53,8 +53,8 @@ class CallAmbulancePage extends StatelessWidget {
ExpandableBottomSheet (
bottomSheetType: context . watch < EmergencyServicesViewModel > ( ) . bottomSheetType ,
children: {
BottomSheetType . EXPANDED: Expan edBottomSheet( context ) ,
BottomSheetType . FIXED: FixedBottomSheet ( context ) ,
BottomSheetType . EXPANDED: Expan d edBottomSheet( context ) ,
BottomSheetType . FIXED: pickUpDetailAndAppointementSection ( context ) ,
} ,
) ,
] ,
@ -92,7 +92,7 @@ class CallAmbulancePage extends StatelessWidget {
) ;
}
Widget Fix edBottomSheet( BuildContext context ) {
Widget Expand edBottomSheet( BuildContext context ) {
return GestureDetector (
onVerticalDragUpdate: ( details ) {
/ / if ( details . delta . dy < 0 ) {
@ -172,7 +172,11 @@ class CallAmbulancePage extends StatelessWidget {
CustomButton (
text: LocaleKeys . selectDetails . tr ( context: context ) ,
onPressed: ( ) {
context . read < EmergencyServicesViewModel > ( ) . updateBottomSheetState ( BottomSheetType . EXPANDED ) ;
LocationViewModel locationViewModel = context . read < LocationViewModel > ( ) ;
GeocodeResponse ? response = locationViewModel . geocodeResponse ;
PlaceDetails ? placeDetails = locationViewModel . placeDetails ;
PlacePrediction ? placePrediction = locationViewModel . selectedPrediction ;
context . read < EmergencyServicesViewModel > ( ) . submitAmbulanceRequest ( response ? . results . first , placeDetails , placePrediction ) ;
} )
] ,
) . paddingOnly ( top: 24. h , bottom: 32. h , left: 24. h , right: 24. h ) ,
@ -185,7 +189,7 @@ class CallAmbulancePage extends StatelessWidget {
) ;
}
Widget ExpanedBottomSheet ( BuildContext context ) {
Widget pickUpDetailAndAppointementSection ( BuildContext context ) {
return GestureDetector (
onVerticalDragUpdate: ( details ) {
if ( details . delta . dy > 0 ) {
@ -324,28 +328,34 @@ class CallAmbulancePage extends StatelessWidget {
)
] ,
) ,
if ( AmbulanceCallingPlace . TO_HOSPITAL = = context . read < EmergencyServicesViewModel > ( ) . callingPlace )
Row (
children: [
hospitalAndPickUpItemContent (
title: LocaleKeys . appointment . tr ( context: context ) ,
subTitle: LocaleKeys . haveAnyAppointment . tr ( context: context ) ,
leadingIcon: AppAssets . appointment_calendar_icon ,
) ,
CustomSwitch (
value: context . watch < EmergencyServicesViewModel > ( ) . haveAnAppointment ,
onChanged: ( value ) async {
/ / if ( value ) {
/ / openAppointmentList ( context ) ;
/ / }
await context . read < EmergencyServicesViewModel > ( ) . updateAppointment ( value ) ;
if ( context . read < EmergencyServicesViewModel > ( ) . appointments ? . isNotEmpty = = true ) {
openAppointmentList ( context ) ;
}
} ,
)
] ,
) ,
Row (
children: [
hospitalAndPickUpItemContent (
title: LocaleKeys . appointment . tr ( context: context ) ,
subTitle: LocaleKeys . haveAnyAppointment . tr ( context: context ) ,
leadingIcon: AppAssets . appointment_calendar_icon ,
) ,
CustomSwitch (
value: context . watch < EmergencyServicesViewModel > ( ) . haveAnAppointment ,
onChanged: ( value ) async {
/ / if ( value ) {
/ / openAppointmentList ( context ) ;
/ / }
await context . read < EmergencyServicesViewModel > ( ) . updateAppointment ( value ) ;
if ( context . read < EmergencyServicesViewModel > ( ) . appointments ? . isNotEmpty = = true ) {
openAppointmentList ( context ) ;
}
} ,
)
] ,
) ,
/ / Visibility (
/ / visible: ,
/ / child:
/ / ) ,
] ,
) . paddingAll ( 16. h ) ,
) ;
@ -460,12 +470,8 @@ class CallAmbulancePage extends StatelessWidget {
CustomButton (
text: LocaleKeys . submitRequest . tr ( context: context ) ,
onPressed: ( ) {
LocationViewModel locationViewModel = context . read < LocationViewModel > ( ) ;
GeocodeResponse ? response = locationViewModel . geocodeResponse ;
PlaceDetails ? placeDetails = locationViewModel . placeDetails ;
PlacePrediction ? placePrediction = locationViewModel . selectedPrediction ;
context . read < EmergencyServicesViewModel > ( ) . submitAmbulanceRequest ( response ? . results . first , placeDetails , placePrediction ) ;
} )
context . read < EmergencyServicesViewModel > ( ) . updateBottomSheetState ( BottomSheetType . EXPANDED ) ;
} )
] ,
) . paddingOnly ( top: 24. h , bottom: 12. h , left: 24. h , right: 24. h ) ,
) ,
@ -582,21 +588,24 @@ class CallAmbulancePage extends StatelessWidget {
}
hospitalField ( BuildContext context ) {
return DecoratedBox (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration ( color: AppColors . whiteColor , borderRadius: 12. h ) ,
child: Row (
children: [
hospitalAndPickUpItemContent (
title: LocaleKeys . selectHospital . tr ( context: context ) ,
subTitle: context . read < EmergencyServicesViewModel > ( ) . getSelectedHospitalName ( ) ? ? LocaleKeys . selectHospital . tr ( context: context ) ,
leadingIcon: AppAssets . hospital ,
) ,
Utils . buildSvgWithAssets ( icon: AppAssets . down_cheveron , width: 24. h , height: 24. h ) . paddingAll ( 16. h )
] ,
) . onPress ( ( ) {
showHospitalBottomSheet ( context ) ;
} ) . paddingSymmetrical (
10. w , 12. h ) ,
return Visibility (
visible: false = = context . watch < EmergencyServicesViewModel > ( ) . haveAnAppointment ,
child: DecoratedBox (
decoration: RoundedRectangleBorder ( ) . toSmoothCornerDecoration ( color: AppColors . whiteColor , borderRadius: 12. h ) ,
child: Row (
children: [
hospitalAndPickUpItemContent (
title: LocaleKeys . selectHospital . tr ( context: context ) ,
subTitle: context . read < EmergencyServicesViewModel > ( ) . getSelectedHospitalName ( ) ? ? LocaleKeys . selectHospital . tr ( context: context ) ,
leadingIcon: AppAssets . hospital ,
) ,
Utils . buildSvgWithAssets ( icon: AppAssets . down_cheveron , width: 24. h , height: 24. h ) . paddingAll ( 16. h )
] ,
) . onPress ( ( ) {
showHospitalBottomSheet ( context ) ;
} ) . paddingSymmetrical (
10. w , 12. h ) ,
) ,
) ;
}