This commit is contained in:
Hamza-Ayed
2024-05-31 12:13:19 +03:00
parent efec9eb6a2
commit 794bc8fb24
5 changed files with 130 additions and 36 deletions

View File

@@ -22,25 +22,30 @@ class CarType {
List<CarType> carTypes = [
CarType(
carType: 'Comfort',
carDetail: 'Comfort choice'.tr,
image: 'assets/images/blob.png'),
carType: 'Comfort',
carDetail: 'Comfort choice'.tr,
image: 'assets/images/blob.png',
),
CarType(
carType: 'Speed',
carDetail: 'Closest & Cheapest'.tr,
image: 'assets/images/carspeed.png'),
carType: 'Speed',
carDetail: 'Closest & Cheapest'.tr,
image: 'assets/images/carspeed.png',
),
CarType(
carType: 'Lady',
carDetail: 'Lady Captain for girls'.tr,
image: 'assets/images/blob.png'),
carType: 'Lady',
carDetail: 'Lady Captain for girls'.tr,
image: 'assets/images/lady.png',
),
CarType(
carType: 'Delivery',
carDetail: 'Delivery service'.tr,
image: 'assets/images/moto.png'),
carType: 'Delivery',
carDetail: 'Delivery service'.tr,
image: 'assets/images/moto.png',
),
CarType(
carType: 'Mashwari',
carDetail: 'Mashwari without end point'.tr,
image: 'assets/images/freeRide.png'),
carType: 'Mashwari',
carDetail: 'Mashwari without end point'.tr,
image: 'assets/images/freeRide.png',
),
];
class CarDetailsTypeToChoose extends StatelessWidget {
@@ -50,6 +55,25 @@ class CarDetailsTypeToChoose extends StatelessWidget {
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(
builder: (mapPassengerController) {
if (mapPassengerController.distance > 80) {
carTypes.add(
CarType(
carType: 'Rayeh Gai',
carDetail: "Best choice for cities".tr,
image: 'assets/images/freeRide.png',
),
);
} // Create a Set to remove duplicates based on the `carType` field
Set<CarType> uniqueCarTypes = {};
uniqueCarTypes.addAll(carTypes);
// Convert the Set back to a List
carTypes = uniqueCarTypes.toList();
if (carTypes.length > 6) {
carTypes.removeRange(6, carTypes.length);
}
return mapPassengerController.data.isNotEmpty &&
mapPassengerController.isBottomSheetShown &&
mapPassengerController.rideConfirm == false
@@ -99,7 +123,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
child: Column(
children: [
Text(
carType.carType,
carType.carType.tr,
style: AppStyle.title.copyWith(
fontWeight: FontWeight.bold,
fontSize: 20),
@@ -128,7 +152,12 @@ class CarDetailsTypeToChoose extends StatelessWidget {
? mapPassengerController
.totalPassengerLady
.toStringAsFixed(2)
: '50',
: carType.carType ==
'Rayeh Gai'
? mapPassengerController
.totalPassengerRayehGai
.toStringAsFixed(2)
: '50',
style:
AppStyle.title.copyWith(fontSize: 20),
),
@@ -403,9 +432,42 @@ class CarDetailsTypeToChoose extends StatelessWidget {
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/blob.png',
text: 'This trip just for girls only'
.tr),
image: 'assets/images/lady.png',
text:
"This trip is for women only".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, 'Rayeh Gai');
mapPassengerController.totalPassenger =
mapPassengerController.totalPassengerLady;
Get.defaultDialog(
title: 'Rayeh Gai'.tr,
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/lady.png',
text:
"Rayeh Gai: Round trip service for convenient travel between cities, easy and reliable."
.tr),
confirm: MyElevatedButton(
kolor: AppColor.greenColor,
title: 'Next'.tr,

View File

@@ -56,7 +56,7 @@ class MainBottomMenuMap extends StatelessWidget {
child: controller.isPickerShown
? clickPointPosition(
controller, context)
: whereWidgetsmall(controller),
: whereWidgetSmall(controller),
),
)),
),
@@ -122,16 +122,17 @@ class MainBottomMenuMap extends StatelessWidget {
// Get.back();
// controller.showBottomSheet1();
// }),
TextButton(
onPressed: () {
controller.changeMainBottomMenuMap();
controller.changeWayPointSheet();
},
child: Text(
"If you want add stop click here".tr,
style: AppStyle.title,
),
),
//todo If you want add stop click here
// TextButton(
// onPressed: () {
// controller.changeMainBottomMenuMap();
// controller.changeWayPointSheet();
// },
// child: Text(
// "If you want add stop click here".tr,
// style: AppStyle.title,
// ),
// ),
],
)
],
@@ -169,6 +170,7 @@ class MainBottomMenuMap extends StatelessWidget {
confirm: MyElevatedButton(
title: 'Yes'.tr,
onPressed: () async {
Get.back();
await controller.getLocation();
await controller.getMap(
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
@@ -178,7 +180,6 @@ class MainBottomMenuMap extends StatelessWidget {
controller.showBottomSheet1();
// controller.showBottomSheet1();
Get.back();
},
));
},
@@ -312,7 +313,7 @@ class MainBottomMenuMap extends StatelessWidget {
);
}
Row whereWidgetsmall(MapPassengerController controller) {
Row whereWidgetSmall(MapPassengerController controller) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -367,8 +368,8 @@ class MainBottomMenuMap extends StatelessWidget {
}
}
class FavioratePlacesDialogu extends StatelessWidget {
const FavioratePlacesDialogu({
class FaviouratePlacesDialog extends StatelessWidget {
const FaviouratePlacesDialog({
super.key,
});