This commit is contained in:
Hamza-Ayed
2024-01-30 16:58:23 +02:00
parent 18df215d0a
commit 87da645ae5
5 changed files with 448 additions and 51 deletions

View File

@@ -62,6 +62,7 @@ class MapDriverController extends GetxController {
bool isRideFinished = false;
bool isRideStarted = false;
double passengerInfoWindow = Get.height * .35;
double driverEndPage = 100;
double progress = 0;
double progressToPassenger = 0;
bool isRideBegin = false;
@@ -102,6 +103,11 @@ class MapDriverController extends GetxController {
update();
}
void changeDriverEndPage() {
remainingTimeTimerRideBegin < 60 ? driverEndPage = 160 : 100;
update();
}
takeSnapMap() {
mapController!.takeSnapshot();
}
@@ -226,7 +232,7 @@ class MapDriverController extends GetxController {
});
rideIsBeginPassengerTimer();
double pointsSubstraction = 0;
pointsSubstraction = double.parse(paymentAmount) * -1;
pointsSubstraction = double.parse(paymentAmount) * -100;
var res = await CRUD().post(link: AppLink.addDriversWallet, payload: {
'paymentID': 'rideId$rideId',
'amount': (pointsSubstraction).toString(),
@@ -309,6 +315,7 @@ class MapDriverController extends GetxController {
await Future.delayed(const Duration(seconds: 1));
progressTimerRideBegin = i / durationOfRide;
remainingTimeTimerRideBegin = durationOfRide - i;
remainingTimeTimerRideBegin < 60 ? driverEndPage = 160 : 100;
int minutes = (remainingTimeTimerRideBegin / 60).floor();
int seconds = remainingTimeTimerRideBegin % 60;
@@ -429,7 +436,12 @@ class MapDriverController extends GetxController {
width: 10,
color: AppColor.blueColor,
);
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 14));
// final dataBounds = response["routes"][0]["bounds"];
// updateCameraFromBoundsAfterGetMap(dataBounds);
// Fit the camera to the bounds
polyLines.add(polyline);
// rideConfirm = false;
update();
@@ -468,13 +480,31 @@ class MapDriverController extends GetxController {
width: 10,
color: AppColor.redColor,
);
// final dataBounds = response["routes"][0]["bounds"];
polyLinesDestination.add(polyline);
// updateCameraFromBoundsAfterGetMap(dataBounds);
// polyLinesDestination.add(polyline);
// rideConfirm = false;
update();
}
}
void updateCameraFromBoundsAfterGetMap(dynamic response) {
final bounds = response["routes"][0]["bounds"];
LatLng northeast =
LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);
LatLng southwest =
LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);
// Create the LatLngBounds object
LatLngBounds boundsData =
LatLngBounds(northeast: northeast, southwest: southwest);
// Fit the camera to the bounds
var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140);
mapController!.animateCamera(cameraUpdate);
}
void changePassengerInfoWindow() {
isPassengerInfoWindow = !isPassengerInfoWindow;
passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0;