refactored code

faiz_dev
faizatflutter 1 week ago
parent 28f8aec60f
commit dc5eba7d12

@ -21,6 +21,8 @@ import 'package:provider/provider.dart';
class TrackingScreen extends StatelessWidget {
final OrderTrackingState state = OrderTrackingState.ended;
const TrackingScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
@ -45,7 +47,7 @@ class TrackingScreen extends StatelessWidget {
animationSection(),
Column(
spacing: 16.h,
children: [OrderStatus(context), OrderTrackingId(), ContactSection()],
children: [orderStatus(context), orderTrackingId(), contactSection()],
).paddingAll(16.h),
],
))),
@ -59,12 +61,11 @@ class TrackingScreen extends StatelessWidget {
case OrderTrackingState.returning:
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);
}
}
OrderStatus(BuildContext context) {
orderStatus(BuildContext context) {
return Container(
padding: EdgeInsets.all(16.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
@ -137,7 +138,6 @@ class TrackingScreen extends StatelessWidget {
children: [dividerSection, doctorSection(), mapSection(context)],
);
case OrderTrackingState.ended:
default:
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 12.h,
@ -200,16 +200,17 @@ class TrackingScreen extends StatelessWidget {
Widget mapForRequestedCoordinate(BuildContext context) {
// return SizedBox.shrink();
if (context.read<EmergencyServicesViewModel>().isGMSAvailable || Platform.isIOS)
if (context.read<EmergencyServicesViewModel>().isGMSAvailable || Platform.isIOS) {
return GMSMap(
myLocationEnabled: false,
currentLocation: context.read<EmergencyServicesViewModel>().getGMSLocation(),
onCameraMoved: (value) => context.read<EmergencyServicesViewModel>().handleGMSMapCameraMoved(value));
else
} else {
return HMSMap(
myLocationEnabled: false,
currentLocation: context.read<EmergencyServicesViewModel>().getHMSLocation(),
onCameraMoved: (value) => context.read<EmergencyServicesViewModel>().handleHMSMapCameraMoved(value));
}
}
informationRegardingTrackingSection() {
@ -277,12 +278,11 @@ class TrackingScreen extends StatelessWidget {
]),
);
case OrderTrackingState.ended:
default:
return "Arrived".needTranslation.toText21(color: AppColors.textColor, weight: FontWeight.w600);
}
}
OrderTrackingId() {
orderTrackingId() {
return Container(
padding: EdgeInsets.all(16.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
@ -298,17 +298,17 @@ class TrackingScreen extends StatelessWidget {
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),
],
),
);
}
Chip(String title, String iconString, Color iconColor) {
chip(String title, String iconString, Color iconColor) {
return AppCustomChipWidget(
labelText: title,
icon: iconString,
@ -317,7 +317,7 @@ class TrackingScreen extends StatelessWidget {
);
}
ContactSection() {
contactSection() {
return Container(
padding: EdgeInsets.all(16.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
@ -375,7 +375,6 @@ class TrackingScreen extends StatelessWidget {
case OrderTrackingState.returning:
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);
}
}

Loading…
Cancel
Save