This commit is contained in:
Hamza Aleghwairyeen
2024-04-01 14:25:58 +03:00
parent 6a0547276b
commit aa20cd4455
7 changed files with 53 additions and 32 deletions

View File

@@ -206,9 +206,9 @@ class HomeCaptainController extends GetxController {
await addToken();
await getlocation();
onButtonSelected();
await getPaymentToday();
await getDriverRate();
getKazanPercent();
await getKazanPercent();
await getPaymentToday();
getCountRideToday();
getAllPayment();
startPeriodicExecution();
@@ -269,9 +269,10 @@ class HomeCaptainController extends GetxController {
var res = await CRUD().get(
link: AppLink.getDriverRate,
payload: {'driver_id': box.read(BoxName.driverID).toString()});
data = jsonDecode(res);
rating = data['message'][0]['rating'].toString();
var decod = jsonDecode(res);
// print(decod);
rating = decod['message'][0]['rating'].toString();
// print('rating $rating');
update();
}

View File

@@ -501,8 +501,10 @@ update ui for totla results
isRideFinished = true;
isRideStarted = false;
isPriceWindow = false;
if (cartype == 'Comfort') {
if (cartype == 'Comfort' || cartype == 'Free Ride') {
totalCost = price.toStringAsFixed(2);
paymentAmount = totalCost;
// update();
}
box.write(BoxName.statusDriverLocation, 'off');
// changeRideToBeginToPassenger();
@@ -600,7 +602,7 @@ update ui for totla results
await Future.delayed(const Duration(seconds: 1));
recentDistanceToDash = Get.find<LocationController>().totalDistance;
rideTimerFromBegin = i;
price = cartype == 'Comfort'
price = cartype == 'Comfort' || cartype == 'Free Ride'
? (i ~/ 60) +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)

View File

@@ -598,21 +598,7 @@ class MapPassengerController extends GetxController {
rideTimerBegin = false;
isRideFinished = true;
update();
//print('rideTimerBegin: $rideTimerBegin');
//print('isRideFinished: $isRideFinished');
// if (Get.find<PaymentController>().isWalletChecked == true &&
// Get.find<PaymentController>().isCashChecked == false) {
// if (double.parse(box.read(BoxName.passengerWalletTotal)) < 0) {
// totalPassenger = totalCostPassenger +
// double.parse(box.read(BoxName.passengerWalletTotal));
// } else {
// totalPassenger = totalCostPassenger + 0;
// }
// await CRUD().post(link: AppLink.addPassengersWallet, payload: {
// 'passenger_id': box.read(BoxName.passengerID).toString(),
// 'balance': ((-1) * totalPassenger).toString()
// });
// }
}
void tripFinishedFromDriver() async {
@@ -684,7 +670,7 @@ class MapPassengerController extends GetxController {
remainingTime = 0;
// isCancelRidePageShown = true;
update();
rideIsBeginPassengerTimer();
rideIsBeginPassengerTimer();runWhenRideIsBegin();
}
void cancelTimerToPassengerFromDriverAfterApplied() {
@@ -1174,7 +1160,20 @@ class MapPassengerController extends GetxController {
Future runEvery30SecondsUntilConditionMet() async {
// Calculate the duration of the trip in minutes.
double tripDurationInMinutes = durationToPassenger / 4;
double tripDurationInMinutes = durationToPassenger / 6;
int loopCount = tripDurationInMinutes.ceil();
// If the trip duration is less than or equal to 50 minutes, then break the loop.
for (var i = 0; i < loopCount; i++) {
// Wait for 50 seconds.
await Future.delayed(const Duration(seconds: 4));
await getDriverCarsLocationToPassengerAfterApplied();
reloadMarkerDriverCarsLocationToPassengerAfterApplied();
}
}
Future runWhenRideIsBegin() async {
// Calculate the duration of the trip in minutes.
double tripDurationInMinutes = durationToRide / 6;
int loopCount = tripDurationInMinutes.ceil();
// If the trip duration is less than or equal to 50 minutes, then break the loop.
for (var i = 0; i < loopCount; i++) {