This commit is contained in:
Hamza-Ayed
2024-09-11 10:10:18 +03:00
parent 8a9d270672
commit 98ee34490c
13 changed files with 373 additions and 202 deletions

View File

@@ -566,12 +566,14 @@ class MapDriverController extends GetxController {
// Get.find<HomeCaptainController>().changeToAppliedRide('Finished');
// Get.find<HomeCaptainController>().update();
totalCost = price < 30
? carType != 'Comfort' && carType != 'Mashwari' && carType != 'Lady'
? carType != 'Comfort' && carType != 'Mishwar Vip' && carType != 'Lady'
? '20'
: '30'
: price < double.parse(totalPricePassenger)
? totalPricePassenger
: carType != 'Comfort' && carType != 'Mashwari' && carType != 'Lady'
: carType != 'Comfort' &&
carType != 'Mishwar Vip' &&
carType != 'Lady'
? totalPricePassenger
: price.toStringAsFixed(2);
paymentAmount = totalCost;
@@ -633,7 +635,7 @@ class MapDriverController extends GetxController {
box.read(BoxName.driverID),
rideId,
box.read(BoxName.tokenDriver),
// carType == 'Comfort' || carType == 'Mashwari'
// carType == 'Comfort' || carType == 'Mishwar Vip'
// ? price.toStringAsFixed(2)
// : totalPassenger
paymentAmount.toString()
@@ -681,44 +683,178 @@ class MapDriverController extends GetxController {
int rideTimerFromBegin = 0;
double price = 0;
DateTime currentTime = DateTime.now();
void rideIsBeginPassengerTimer() async {
int durationOfRide = int.parse(durationOfRideValue);
update();
int infinity = 40000;
if (carType == 'Comfort' ||
carType == 'Mashwari' ||
carType == 'Rayeh Gai') {
carType == 'Mishwar Vip' ||
carType == 'RayehGaiComfort') {
durationOfRide = infinity;
update();
}
if (carType != 'Comfort' ||
carType != 'Mishwar Vip' ||
carType != 'Lady' ||
carType != 'RayehGaiComfort') {
price = double.parse(totalCost);
update();
}
for (int i = 0; i <= durationOfRide; i++) {
await Future.delayed(const Duration(seconds: 1));
recentDistanceToDash = Get.find<LocationController>().totalDistance;
rideTimerFromBegin = i;
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: carType == 'Speed'
? (i ~/ 60) +
if (startNameLocation.toLowerCase().contains('airport') ||
endNameLocation.toLowerCase().contains('airport') ||
startNameLocation.contains('مطار') ||
startNameLocation.contains('المطار') ||
endNameLocation.contains('مطار') ||
endNameLocation.contains('المطار')) {
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
20 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
// : carType == 'Speed'
// ? (i ~/ 60) +
// (recentDistanceToDash *
// Get.find<HomeCaptainController>().speedPrice)
: carType == 'Lady'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
20 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
// : carType == 'Delivery'
// ? (i ~/ 60) +
// (recentDistanceToDash *
// Get.find<HomeCaptainController>().deliveryPrice)
: carType == 'RayehGaiComfort'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
20 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
20 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().mashwariPrice);
} else if (currentTime.hour >= 21 && currentTime.hour < 0) {
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
20 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
// : carType == 'Speed'
// ? (i ~/ 60) +
// (recentDistanceToDash *
// Get.find<HomeCaptainController>().speedPrice)
: carType == 'Lady'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
20 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
// : carType == 'Delivery'
// ? (i ~/ 60) +
// (recentDistanceToDash *
// Get.find<HomeCaptainController>().deliveryPrice)
: carType == 'RayehGaiComfort'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
20 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
20 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().mashwariPrice);
} else if (currentTime.hour >= 1 && currentTime.hour < 5) {
if (startNameLocation.contains('club') ||
startNameLocation.contains('nightclub') ||
startNameLocation.contains('ديسكو') ||
startNameLocation.contains('ملهى ليلي') ||
startNameLocation.contains('Night club')) {
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice + .5) *
2 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().speedPrice)
Get.find<HomeCaptainController>().comfortPrice)
: carType == 'Lady'
? (i ~/ 60) +
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice + .5) *
2 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: carType == 'Delivery'
? (i ~/ 60) +
: carType == 'RayehGaiComfort'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice +
.5) *
2 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().deliveryPrice)
: carType == 'Rayeh Gai'
? (i ~/ 60) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().speedPrice)
: (i ~/ 60) +
(recentDistanceToDash *
Get.find<HomeCaptainController>()
.mashwariPrice); // $1 for each minute + $4 for each km
Get.find<HomeCaptainController>().comfortPrice)
: (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice +
.5) *
2 +
(recentDistanceToDash *
Get.find<HomeCaptainController>().mashwariPrice);
}
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) * (Get.find<HomeCaptainController>().latePrice + .5) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: carType == 'Lady'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice + .5) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: carType == 'RayehGaiComfort'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice + .5) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice + .5) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().mashwariPrice);
} else if (currentTime.hour >= 14 && currentTime.hour <= 17) {
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) * (Get.find<HomeCaptainController>().heavyPrice) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: carType == 'Lady'
? (i ~/ 60) * (Get.find<HomeCaptainController>().heavyPrice) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: carType == 'RayehGaiComfort'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().heavyPrice) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: (i ~/ 60) *
(Get.find<HomeCaptainController>().heavyPrice) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().mashwariPrice);
} else {
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: carType == 'Lady'
? (i ~/ 60) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: carType == 'RayehGaiComfort'
? (i ~/ 60) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: (i ~/ 60) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().mashwariPrice);
}
// $1 for each minute + $4 for each km
price = (price * double.parse(kazan)) + price; // Add 10% tax
speed = Get.find<LocationController>().speed * 3.6;
progressTimerRideBegin = i / durationOfRide;