10/17/1
This commit is contained in:
@@ -35,6 +35,7 @@ class MapDriverController extends GetxController {
|
||||
late String durationToPassenger;
|
||||
late String walletChecked;
|
||||
late String direction;
|
||||
late String durationOfRideValue;
|
||||
late String status;
|
||||
bool isPassengerInfoWindow = false;
|
||||
bool isBtnRideBegin = false;
|
||||
@@ -50,7 +51,9 @@ class MapDriverController extends GetxController {
|
||||
bool isDriverNearPassengerStart = false;
|
||||
GoogleMapController? mapController;
|
||||
late LatLng myLocation;
|
||||
|
||||
int remainingTimeTimerRideBegin = 60;
|
||||
String stringRemainingTimeRideBegin = '';
|
||||
double progressTimerRideBegin = 0;
|
||||
late Timer timer;
|
||||
|
||||
void onMapCreated(GoogleMapController controller) {
|
||||
@@ -59,7 +62,7 @@ class MapDriverController extends GetxController {
|
||||
mapController = controller;
|
||||
controller.getVisibleRegion();
|
||||
controller.animateCamera(
|
||||
CameraUpdate.newLatLngZoom(myLocation, 10),
|
||||
CameraUpdate.newLatLngZoom(myLocation, 15),
|
||||
);
|
||||
update();
|
||||
|
||||
@@ -173,12 +176,14 @@ class MapDriverController extends GetxController {
|
||||
isRideStarted = true;
|
||||
isRideFinished = false;
|
||||
box.write(BoxName.statusDriverLocation, 'on');
|
||||
|
||||
update();
|
||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
'id': rideId,
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin'
|
||||
});
|
||||
rideIsBeginPassengerTimer();
|
||||
// FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||
// 'RideIsBegin', box.read(BoxName.name).toString(), tokenPassenger);
|
||||
}
|
||||
@@ -204,6 +209,24 @@ class MapDriverController extends GetxController {
|
||||
// 'isRideFinished', box.read(BoxName.name).toString(), tokenPassenger);
|
||||
}
|
||||
|
||||
void rideIsBeginPassengerTimer() async {
|
||||
// print('mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm');
|
||||
// print(durationOfRideValue);
|
||||
int durationOfRide = int.parse(durationOfRideValue);
|
||||
|
||||
for (int i = 0; i <= durationOfRide; i++) {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
progressTimerRideBegin = i / durationOfRide;
|
||||
remainingTimeTimerRideBegin = durationOfRide - i;
|
||||
|
||||
int minutes = (remainingTimeTimerRideBegin / 60).floor();
|
||||
int seconds = remainingTimeTimerRideBegin % 60;
|
||||
stringRemainingTimeRideBegin =
|
||||
'$minutes:${seconds.toString().padLeft(2, '0')}';
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void updateMarker() {
|
||||
// Remove the existing marker with the ID `MyLocation`.
|
||||
markers.remove(MarkerId('MyLocation'.tr));
|
||||
@@ -310,6 +333,7 @@ class MapDriverController extends GetxController {
|
||||
direction = Get.arguments['direction'];
|
||||
durationToPassenger = Get.arguments['DurationToPassenger'];
|
||||
rideId = Get.arguments['rideId'];
|
||||
durationOfRideValue = Get.arguments['durationOfRideValue'];
|
||||
String lat = Get.find<LocationController>().myLocation.latitude.toString();
|
||||
String lng = Get.find<LocationController>().myLocation.longitude.toString();
|
||||
String origin = '$lat,$lng';
|
||||
|
||||
Reference in New Issue
Block a user