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

@@ -217,6 +217,7 @@ class MapPassengerController extends GetxController {
late double totalPassengerComfortDiscount = 0;
late double totalPassengerLadyDiscount = 0;
late double totalPassengerSpeedDiscount = 0;
late double totalPassengerRaihGaiDiscount = 0;
late double totalPassengerMotoDelivery = 0;
late double totalDriver = 0;
late double averageDuration = 0;
@@ -2075,7 +2076,10 @@ class MapPassengerController extends GetxController {
late LatLngBounds boundsData;
late String startNameAddress = '';
late String endNameAddress = '';
getMap(String origin, destination) async {
isLoading = true;
update();
remainingTime = 25; //to make cancel every call
await getCarsLocationByPassengerAndReloadMarker();
// //print(carsLocationByPassenger);
@@ -2382,6 +2386,7 @@ class MapPassengerController extends GetxController {
double costForDriver = 0;
double totalPassengerSpeed = 0;
double totalPassengerLady = 0;
double totalPassengerRayehGai = 0;
Future bottomSheet() async {
if (data.isNotEmpty) {
durationToAdd = Duration(seconds: durationToRide);
@@ -2396,9 +2401,10 @@ class MapPassengerController extends GetxController {
costDuration = (durationToRide / 60).floorToDouble();
print('costDuration----- $costDuration');
print('costDistance----- $costDistance');
print('Distance----- $distance');
print(
'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}');
double costComfort, costSpeed, costDelivery, costLady = 0;
double costComfort, costSpeed, costDelivery, costLady, costRayehGai = 0;
update();
if (currentTime.hour >= 22 && currentTime.hour < 5) {
// costDistance = distance * latePrice;
@@ -2406,6 +2412,9 @@ class MapPassengerController extends GetxController {
costSpeed = (distance * speedPrice) + costDuration * latePrice;
costDelivery = (distance * deliveryPrice) + costDuration * latePrice;
costLady = (distance * comfortPrice + 2) + costDuration * latePrice;
costRayehGai = (distance * 2 * speedPrice) -
((distance * 2 * speedPrice) * .3) +
costDuration * latePrice;
update();
} else if (currentTime.hour >= 13 && currentTime.hour <= 16) {
@@ -2415,6 +2424,9 @@ class MapPassengerController extends GetxController {
costSpeed = (distance * speedPrice) + costDuration * heavyPrice;
costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice;
costLady = (distance * comfortPrice + 2) + costDuration * heavyPrice;
costRayehGai = (distance * 2 * speedPrice) -
((distance * 2 * speedPrice) * .3) +
costDuration * heavyPrice;
update();
// } /
@@ -2424,6 +2436,9 @@ class MapPassengerController extends GetxController {
costSpeed = (distance * speedPrice) + costDuration;
costDelivery = (distance * deliveryPrice) + costDuration;
costLady = (distance * comfortPrice + 2) + costDuration;
costRayehGai = (distance * 2 * speedPrice) -
((distance * 2 * speedPrice) * .3) +
costDuration;
update();
}
//print('cost $cost');
@@ -2436,12 +2451,16 @@ class MapPassengerController extends GetxController {
totalPassengerLady = (costLady + (costLady * kazan / 100)).ceilToDouble();
totalPassengerSpeed =
(costSpeed + (costSpeed * kazan / 100)).ceilToDouble();
totalPassengerRayehGai =
(costRayehGai + (costRayehGai * kazan / 100)).ceilToDouble();
totalPassengerComfortDiscount =
totalPassengerComfort + totalPassengerComfort * (kazan - 0) / 100;
totalPassengerLadyDiscount =
totalPassengerLady + totalPassengerLady * (kazan - 0) / 100;
totalPassengerSpeedDiscount =
totalPassengerSpeed + totalPassengerSpeed * (kazan - 2) / 100;
totalPassengerRaihGaiDiscount =
totalPassengerRayehGai + totalPassengerRayehGai * (kazan - 2) / 100;
totalPassengerMotoDelivery =
(costDelivery + (costDelivery * kazan / 100)).ceilToDouble();
totalPassengerComfort = totalPassengerComfortDiscount -

View File

@@ -4,6 +4,18 @@ class MyTranslation extends Translations {
@override
Map<String, Map<String, String>> get keys => {
"ar": {
"Best choice for cities": "أفضل اختيار للمدن",
"Rayeh Gai: Round trip service for convenient travel between cities, easy and reliable.":
" رايح جاي: خدمة ذهاب وعودة للسفر المريح بين المدن، سهلة وموثوقة.",
"Rayeh Gai": "رايح جاي ",
"This trip is for women only": "هذه الرحلة للنساء فقط",
"Total budgets on month": "إجمالي الميزانية لهذا الشهر",
"You have call from driver": " لديك مكالمة من السائق",
"Comfort": "كمفورت",
"Speed": "سبيد",
"Lady": "ليدي",
"Delivery": "توصيل",
"Mashwari": "‏مشواري",
'The driver waiting you in picked location .':
"السائق ينتظرك في موقع الركوب.",
'About Us': "نبذة عنا",

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,
});