This commit is contained in:
Hamza-Ayed
2023-10-14 15:03:19 +03:00
parent c1e4c74356
commit 642820c55b
24 changed files with 191 additions and 218 deletions

View File

@@ -56,7 +56,7 @@ class MapPassengerController extends GetxController {
bool isMainBottomMenuMap = true;
double heightBottomSheetShown = 0;
double cashConfirmPageShown = 250;
late String driverId;
double widthMapTypeAndTraffic = 50;
double paymentPageShown = Get.height * .6;
late LatLng southwest;
@@ -77,7 +77,7 @@ class MapPassengerController extends GetxController {
int timeToPassengerFromDriverAfterApplied = 0;
Timer? timerToPassengerFromDriverAfterApplied;
bool rideTimerBegin = false;
late double progressTimerRideBegin;
double progressTimerRideBegin = 0;
int remainingTimeTimerRideBegin = 60;
late String stringRemainingTimeRideBegin;
@@ -175,23 +175,10 @@ class MapPassengerController extends GetxController {
update();
print('rideTimerBegin: $rideTimerBegin');
print('isRideFinished: $isRideFinished');
Get.to(() => RateCaptain());
// Get.defaultDialog(
// title: 'Ride Is Finished.'.tr,
// titleStyle: AppStyle.title,
// content: Text(
// 'Rate the Captain Please?'.tr,
// style: AppStyle.title,
// ),
// confirm: MyElevatedButton(
// title: 'Ok'.tr,
// onPressed: () {
//
// Get.back(); //todo make Rate page
// },
// ),
// barrierDismissible: false,
// );
Get.to(() => RateCaptainFromPassenger(), arguments: {
'driverId': driverId.toString(),
'rideId': rideId.toString(),
});
}
void getBeginRideFromDriver() async {
@@ -260,7 +247,7 @@ class MapPassengerController extends GetxController {
"time": DateTime.now().toString(),
"endtime": durationToAdd.toString(),
"price": totalPassenger.toString(),
"passenger_id": box.read(BoxName.pasengerID).toString(),
"passenger_id": box.read(BoxName.passengerID).toString(),
"driver_id": dataCarsLocationByPassenger['message'][carsOrder]
['driver_id']
.toString(),
@@ -280,7 +267,7 @@ class MapPassengerController extends GetxController {
duration.toString(),
distance.toString(),
dataCarsLocationByPassenger['message'][carsOrder]['id'].toString(),
box.read(BoxName.pasengerID).toString(),
box.read(BoxName.passengerID).toString(),
box.read(BoxName.name).toString(),
box.read(BoxName.tokenFCM).toString(),
box.read(BoxName.phone).toString(),
@@ -405,7 +392,10 @@ class MapPassengerController extends GetxController {
} else {
dataCarsLocationByPassenger = jsonDecode(res);
// print(dataCarsLocationByPassenger);
driverId = dataCarsLocationByPassenger['message'][carsOrder]
['driver_id']
.toString();
// print('driverId==============$driverId');
for (var i = 0;
i < dataCarsLocationByPassenger['message'].length;
i++) {
@@ -444,14 +434,14 @@ class MapPassengerController extends GetxController {
Future runEvery30SecondsUntilConditionMet() async {
// Calculate the duration of the trip in minutes.
double tripDurationInMinutes = duration1 / 60;
double tripDurationInMinutes = duration1 / 30;
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:
30)); // Run the `getDriverCarsLocationToPassengerAfterApplied()` function.
31)); // Run the `getDriverCarsLocationToPassengerAfterApplied()` function.
await getDriverCarsLocationToPassengerAfterApplied();
reloadMarkerDriverCarsLocationToPassengerAfterApplied();
}
@@ -483,6 +473,16 @@ class MapPassengerController extends GetxController {
} // Update the map with the new markers
}
restCounter() {
clearPlaces();
clearPolyline();
data = [];
rideConfirm = false;
shouldFetch = false;
timeToPassengerFromDriverAfterApplied = 0;
update();
}
Future cancelRide() async {
print(rideConfirm);
@@ -511,7 +511,7 @@ class MapPassengerController extends GetxController {
.driverID
.toString(), // Convert to String
"passengerID":
box.read(BoxName.pasengerID).toString(), // Convert to String
box.read(BoxName.passengerID).toString(), // Convert to String
"rideID": rideId.toString(), // Convert to String
"note": cancelNote
});