ambulance call page changes:

1. icon change for the success of ambulance call and rrt.
2. flow changed to first select the appoiintment then hospital.
3. location accorate enabled.
changes
tahaalam 22 hours ago
parent 12b611500d
commit fb93aa1092

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

@ -400,6 +400,11 @@ class AppAssets {
static const String fullBodyFrontFemale = '$pngBasePath/full_body_front_female.png';
static const String fullBodyBackFemale = '$pngBasePath/full_body_back_female.png';
static const String bmiFullBody = '$pngBasePath/bmi_image_1.png';
static const String ambulance_section = '$pngBasePath/ambulance_section.png';
static const String rrt_section = '$pngBasePath/rrt_section.png';
}
class AppAnimations {

@ -820,6 +820,28 @@ class Utils {
// return Image.asset(icon, width: width, height: height, fit: fit, );
}
static Widget buildImgWithAssetsWithBorderRadius({
required String icon,
Color? iconColor,
bool isDisabled = false,
double? width,
double? height,
BoxFit fit = BoxFit.cover,
double? border,
double? borderRadius,
}) {
final iconH = height ?? 24.h;
final iconW = width ?? 24.w;
return Container(
width: iconW, height: iconH,
decoration: BoxDecoration(
border: border != null ? Border.all(color: AppColors.whiteColor, width: border) : null,
borderRadius: borderRadius != null ? BorderRadius.circular(borderRadius ?? 12.r) : null,
image: DecorationImage(image: AssetImage(icon,), fit: fit)
),
);
}
/// Widget to build an SVG from network
static Widget buildImgWithNetwork({
required String url,

@ -310,17 +310,21 @@ class EmergencyServicesViewModel extends ChangeNotifier {
}
void updateBottomSheetState(BottomSheetType sheetType) {
if (sheetType == BottomSheetType.EXPANDED && selectedHospital == null) {
dialogService.showErrorBottomSheet(message: LocaleKeys.selectHospital.tr());
return;
}
// if (sheetType == BottomSheetType.EXPANDED && selectedHospital == null) {
// dialogService.showErrorBottomSheet(message: LocaleKeys.selectHospital.tr());
// return;
// }
bottomSheetType = sheetType;
if (sheetType == BottomSheetType.EXPANDED) {
clearAppointmentData();
}
// if (sheetType == BottomSheetType.FIXED) {
// clearAppointmentData();
// }
notifyListeners();
}
void showError(String message) {
dialogService.showErrorBottomSheet(message: message);
}
void setIsGMSAvailable(bool value) {
notifyListeners();
}
@ -732,6 +736,10 @@ class EmergencyServicesViewModel extends ChangeNotifier {
}
FutureOr<void> submitAmbulanceRequest(GeocodeResult? result, PlaceDetails? place, PlacePrediction? placePrediction) async {
if (false == haveAnAppointment && null == selectedHospital) {
dialogService.showErrorBottomSheet(message: LocaleKeys.selectHospital.tr());
return;
}
PatientER_RC request = createRequest(result, place, placePrediction);
navServices.push(CustomPageRoute(page: RequestingServicesPage()));
@ -802,19 +810,19 @@ class EmergencyServicesViewModel extends ChangeNotifier {
request.patientERTransportationMethod = selectedTransportOption;
transportationDetails.pickupUrgency = 1;
switch (callingPlace) {
case AmbulanceCallingPlace.FROM_HOSPITAL:
transportationDetails.dropoffLatitude = selectedHospital!.latitude;
transportationDetails.dropoffLongitude = selectedHospital!.longitude;
transportationDetails.dropoffLocationName = selectedHospital!.name;
case AmbulanceCallingPlace.TO_HOSPITAL:
transportationDetails.dropoffLatitude = selectedHospital?.latitude;
transportationDetails.dropoffLongitude = selectedHospital?.longitude;
transportationDetails.dropoffLocationName = selectedHospital?.name;
transportationDetails.pickupLatitude = ((result?.geometry.location.lat) ?? place?.lat)?.toStringAsFixed(6);
transportationDetails.pickupLongitude = ((result?.geometry.location.lng) ?? place?.lng)?.toStringAsFixed(6);
transportationDetails.pickupLocationName = result?.formattedAddress ?? placePrediction?.description;
transportationDetails.direction = 1;
break;
case AmbulanceCallingPlace.TO_HOSPITAL:
transportationDetails.pickupLatitude = selectedHospital!.latitude;
transportationDetails.pickupLongitude = selectedHospital!.longitude;
transportationDetails.pickupLocationName = selectedHospital!.name;
case AmbulanceCallingPlace.FROM_HOSPITAL:
transportationDetails.pickupLatitude = selectedHospital?.latitude;
transportationDetails.pickupLongitude = selectedHospital?.longitude;
transportationDetails.pickupLocationName = selectedHospital?.name;
transportationDetails.dropoffLatitude = ((result?.geometry.location.lat) ?? place?.lat)?.toStringAsFixed(6);
transportationDetails.dropoffLongitude = ((result?.geometry.location.lng) ?? place?.lng)?.toStringAsFixed(6);
transportationDetails.dropoffLocationName = result?.formattedAddress ?? placePrediction?.description;

@ -53,8 +53,8 @@ class CallAmbulancePage extends StatelessWidget {
ExpandableBottomSheet(
bottomSheetType: context.watch<EmergencyServicesViewModel>().bottomSheetType,
children: {
BottomSheetType.EXPANDED: ExpanedBottomSheet(context),
BottomSheetType.FIXED: FixedBottomSheet(context),
BottomSheetType.EXPANDED: ExpandedBottomSheet(context),
BottomSheetType.FIXED: pickUpDetailAndAppointementSection(context),
},
),
],
@ -92,7 +92,7 @@ class CallAmbulancePage extends StatelessWidget {
);
}
Widget FixedBottomSheet(BuildContext context) {
Widget ExpandedBottomSheet(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),
),
);
}

@ -73,7 +73,10 @@ class TrackingScreen extends StatelessWidget {
child: SingleChildScrollView(
child: Column(
children: [
animationSection(),
Padding(
padding: EdgeInsetsDirectional.only(top:16.h,start: 16.w,end: 16.w ),
child: animationSection(context),
),
Column(
spacing: 16.h,
children: [orderStatus(context), orderTrackingId(context), contactSection()],
@ -83,12 +86,12 @@ class TrackingScreen extends StatelessWidget {
);
}
animationSection() {
animationSection(BuildContext context) {
switch (state) {
case OrderTrackingState.waitingForCall:
case OrderTrackingState.dispactched:
case OrderTrackingState.returning:
return Lottie.asset(AppAnimations.ambulance, repeat: true, reverse: false, width: 260.h, height: 200.h);
return showImage(order != null ? AppAssets.ambulance_section : AppAssets.rrt_section, context);
case OrderTrackingState.ended:
return Lottie.asset(AppAnimations.checkmark, repeat: true, width: 260.h, height: 200.h);
case OrderTrackingState.failed:
@ -489,6 +492,18 @@ class TrackingScreen extends StatelessWidget {
);
}
showImage(String imageUrl, BuildContext context) {
return Utils.buildImgWithAssetsWithBorderRadius(
icon: imageUrl,
iconColor: Colors.transparent,
width: MediaQuery.sizeOf(context).width,
height: 380.h,
borderRadius: 24.r,
border: 1.r/// did this as the function that is being called is wrongly coupled with the border radius and border, and in some cases like the ambulance and rrt section we don't need any
/// border or border radius
);
}
// Widget rrtOrderData() {
// return Row(
// spacing: 8.h,

@ -26,12 +26,7 @@ class OrderTrackingWidget extends StatelessWidget {
Widget? getBarAndDot(OrderTrackingState? state, BuildContext context,
double width) {
print("the parent padding value is $parentPaddingValue");
print("the parent padding value is ${(parentPaddingValue+24)}");
print("the width - (parentPaddingValue+24) ${(width - (parentPaddingValue+24))}");
double widthOfOneState = (width/4) - (parentPaddingValue+8.h);
print("te width of one state is $widthOfOneState");
print("the value of${width/4}");
if(state == null) {
return Row(
children: List.generate(4, (index) {

Loading…
Cancel
Save