This commit is contained in:
Hamza-Ayed
2024-09-15 09:53:40 +03:00
parent e23709c924
commit 9752d61230
24 changed files with 9002 additions and 221 deletions

View File

@@ -35,7 +35,7 @@ List<CarType> carTypes = [
image: 'assets/images/carspeed.png',
),
CarType(
carType: 'Balash',
carType: 'Awfar Car',
carDetail: "Old and affordable, perfect for budget rides.".tr,
image: 'assets/images/balash.png',
),
@@ -45,15 +45,20 @@ List<CarType> carTypes = [
image: 'assets/images/lady.png',
),
CarType(
carType: 'Delivery',
carType: 'Scooter',
carDetail: 'Delivery service'.tr,
image: 'assets/images/moto.png',
),
CarType(
carType: 'Mashwari',
carType: 'Mishwar Vip',
carDetail: 'Mashwari without end point'.tr,
image: 'assets/images/freeRide.png',
),
CarType(
carType: 'Pink Bike',
carDetail: "Best choice for cities".tr,
image: 'assets/images/pinkBike.png',
),
CarType(
carType: 'Rayeh Gai',
carDetail: "Best choice for cities".tr,
@@ -68,6 +73,26 @@ class CarDetailsTypeToChoose extends StatelessWidget {
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(
builder: (mapPassengerController) {
if (mapPassengerController.distance > 40) {
carTypes.add(
CarType(
carType: 'Rayeh Gai',
carDetail: "Best choice for cities".tr,
image: 'assets/images/roundtrip.png',
),
);
if (carTypes.length > 8) {
carTypes.removeRange(8, carTypes.length);
}
} // Create a Set to remove duplicates based on the `carType` field
else if (carTypes.length > 7) {
carTypes.removeRange(7, carTypes.length);
}
Set<CarType> uniqueCarTypes = {};
uniqueCarTypes.addAll(carTypes);
// Convert the Set back to a List
carTypes = uniqueCarTypes.toList();
return mapPassengerController.data.isNotEmpty &&
mapPassengerController.isBottomSheetShown &&
mapPassengerController.rideConfirm == false
@@ -138,25 +163,31 @@ class CarDetailsTypeToChoose extends StatelessWidget {
? mapPassengerController
.totalPassengerSpeed
.toStringAsFixed(2)
: carType.carType == 'Balash'
: carType.carType == 'Awfar Car'
? mapPassengerController
.totalPassengerBalash
.toStringAsFixed(2)
: carType.carType == 'Delivery'
: carType.carType == 'Scooter'
? mapPassengerController
.totalPassengerMotoDelivery
.totalPassengerScooter
.toStringAsFixed(2)
: carType.carType == 'Lady'
? mapPassengerController
.totalPassengerLady
.toStringAsFixed(2)
: carType.carType ==
'Rayeh Gai'
'Pink Bike'
? mapPassengerController
.totalPassengerRayehGai
.totalPassengerScooter
.toStringAsFixed(
2)
: '50',
: carType.carType ==
'Rayeh Gai'
? mapPassengerController
.totalPassengerRayehGai
.toStringAsFixed(
2)
: '50',
style:
AppStyle.title.copyWith(fontSize: 20),
),
@@ -228,7 +259,8 @@ class CarDetailsTypeToChoose extends StatelessWidget {
)
],
)
: carType.carType == 'Balash' &&
: carType.carType ==
'Awfar Car' &&
(mapPassengerController
.totalPassengerBalash >
15)
@@ -400,12 +432,12 @@ class CarDetailsTypeToChoose extends StatelessWidget {
} else if (mapPassengerController
.selectedIndex ==
4) {
box.write(BoxName.carType, 'Delivery');
box.write(BoxName.carType, 'Scooter');
mapPassengerController.totalPassenger =
mapPassengerController
.totalPassengerMotoDelivery;
.totalPassengerScooter;
Get.defaultDialog(
title: 'Delivery'.tr,
title: 'Scooter'.tr,
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
@@ -431,13 +463,47 @@ class CarDetailsTypeToChoose extends StatelessWidget {
onPressed: () {
Get.back();
}));
} else if (mapPassengerController
.selectedIndex ==
6) {
box.write(BoxName.carType, 'Pink Bike');
mapPassengerController.totalPassenger =
mapPassengerController
.totalPassengerScooter;
Get.defaultDialog(
title: 'Pink Bike'.tr,
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/pinkBike.png',
text:
'This is for delivery or a motorcycle.'
.tr),
confirm: MyElevatedButton(
kolor: AppColor.greenColor,
title: 'Next'.tr,
onPressed: () {
Get.back();
mapPassengerController
.isBottomSheetShown = false;
mapPassengerController.update();
mapPassengerController
.changeCashConfirmPageShown();
}),
cancel: MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
} else if (mapPassengerController
.selectedIndex ==
5) {
box.write(BoxName.carType, 'Mashwari');
box.write(BoxName.carType, 'Mishwar Vip');
mapPassengerController.totalPassenger = 50;
Get.defaultDialog(
title: 'Mashwari'.tr,
title: 'Mishwar Vip'.tr,
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
@@ -463,12 +529,12 @@ class CarDetailsTypeToChoose extends StatelessWidget {
} else if (mapPassengerController
.selectedIndex ==
2) {
box.write(BoxName.carType, 'Balash');
box.write(BoxName.carType, 'Awfar Car');
mapPassengerController.totalPassenger =
mapPassengerController
.totalPassengerBalash;
Get.defaultDialog(
title: 'Balash'.tr,
title: 'Awfar Car'.tr,
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
@@ -539,7 +605,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
}));
} else if (mapPassengerController
.selectedIndex ==
6) {
7) {
box.write(BoxName.carType, 'Rayeh Gai');
mapPassengerController.totalPassenger =
mapPassengerController.totalPassengerLady;

View File

@@ -112,23 +112,23 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
// ),
// ),
// ),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () async {
Get.to(SmsSignupEgypt());
},
icon: const Icon(
Icons.chat,
size: 29,
),
),
),
// AnimatedContainer(
// duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic,
// decoration: BoxDecoration(
// color: AppColor.secondaryColor,
// border: Border.all(),
// borderRadius: BorderRadius.circular(15)),
// child: IconButton(
// onPressed: () async {
// Get.to(SmsSignupEgypt());
// },
// icon: const Icon(
// Icons.chat,
// size: 29,
// ),
// ),
// ),
// AnimatedContainer(
// duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic,