8/11/1
This commit is contained in:
@@ -129,9 +129,9 @@ class LocationController extends GetxController {
|
||||
'longitude': myLocation.longitude.toString(),
|
||||
'heading': heading.toString(),
|
||||
'speed': (speed * 3.6).toStringAsFixed(1),
|
||||
'distance': totalDistance == 0
|
||||
'distance': totalDistance == 0 && (speed * 3.6) < 5
|
||||
? '0.0'
|
||||
: totalDistance < 1
|
||||
: totalDistance < 7
|
||||
? totalDistance.toStringAsFixed(3)
|
||||
: totalDistance.toStringAsFixed(1),
|
||||
'status': box.read(BoxName.statusDriverLocation).toString(),
|
||||
@@ -229,6 +229,10 @@ class LocationController extends GetxController {
|
||||
// Calculate the distance in kilometers
|
||||
double distanceInKilometers = speedInKmPerHour * timeDifferenceInHours;
|
||||
|
||||
return distanceInKilometers;
|
||||
// Convert distance from kilometers to meters
|
||||
double distanceInMeters = distanceInKilometers * 1000;
|
||||
|
||||
// If the calculated distance is less than 6 meters, return 0 to avoid fake distance
|
||||
return distanceInMeters < 5 ? 0 : distanceInKilometers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,166 +694,174 @@ class MapDriverController extends GetxController {
|
||||
durationOfRide = infinity;
|
||||
update();
|
||||
}
|
||||
if (carType != 'Comfort' ||
|
||||
carType != 'Mishwar Vip' ||
|
||||
carType != 'Lady' ||
|
||||
carType != 'RayehGaiComfort') {
|
||||
price = double.parse(totalCost);
|
||||
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;
|
||||
|
||||
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')) {
|
||||
// rideTimerFromBegin = i;
|
||||
if (int.parse(duration) > i) {
|
||||
price = double.parse(totalCost);
|
||||
} else {
|
||||
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 + .5) *
|
||||
2 +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
Get.find<HomeCaptainController>().latePrice
|
||||
|
||||
// : carType == 'Speed'
|
||||
// ? (i ~/ 60) +
|
||||
// (recentDistanceToDash *
|
||||
// Get.find<HomeCaptainController>().speedPrice)
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
Get.find<HomeCaptainController>().latePrice
|
||||
// : carType == 'Delivery'
|
||||
// ? (i ~/ 60) +
|
||||
// (recentDistanceToDash *
|
||||
// Get.find<HomeCaptainController>().deliveryPrice)
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
Get.find<HomeCaptainController>().latePrice +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
: (i ~/ 60) *
|
||||
Get.find<HomeCaptainController>().latePrice +
|
||||
(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 +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
Get.find<HomeCaptainController>().latePrice
|
||||
|
||||
// : carType == 'Speed'
|
||||
// ? (i ~/ 60) +
|
||||
// (recentDistanceToDash *
|
||||
// Get.find<HomeCaptainController>().speedPrice)
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
Get.find<HomeCaptainController>().latePrice
|
||||
// : carType == 'Delivery'
|
||||
// ? (i ~/ 60) +
|
||||
// (recentDistanceToDash *
|
||||
// Get.find<HomeCaptainController>().deliveryPrice)
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
Get.find<HomeCaptainController>().latePrice +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
: (i ~/ 60) *
|
||||
Get.find<HomeCaptainController>().latePrice +
|
||||
(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 +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) *
|
||||
2
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) *
|
||||
2 +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) *
|
||||
2
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice +
|
||||
.5) *
|
||||
2 +
|
||||
(price)
|
||||
: (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice +
|
||||
.5) *
|
||||
2 +
|
||||
(price);
|
||||
}
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
? (i ~/ 60) * (Get.find<HomeCaptainController>().latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5)
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) *
|
||||
2 +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
(Get.find<HomeCaptainController>().latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().latePrice + .5)
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice +
|
||||
.5) *
|
||||
2 +
|
||||
.5) +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
: (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().latePrice +
|
||||
.5) *
|
||||
2 +
|
||||
.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) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().heavyPrice + .5)
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) * (Get.find<HomeCaptainController>().heavyPrice) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().heavyPrice + .5)
|
||||
: 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) + (price) - int.parse(duration)
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) + (price) - int.parse(duration)
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
: (i ~/ 60) +
|
||||
(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;
|
||||
|
||||
Reference in New Issue
Block a user