4/2/5
This commit is contained in:
@@ -438,93 +438,93 @@ class MapDriverController extends GetxController {
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
);
|
||||
if (carType != 'Comfort' || carType != 'Free Ride') {
|
||||
if (distanceToDestination < 50) {
|
||||
isRideFinished = true;
|
||||
isRideStarted = false;
|
||||
isPriceWindow = false;
|
||||
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
// changeRideToBeginToPassenger();
|
||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
'id': rideId,
|
||||
'rideTimeFinish': DateTime.now().toString(),
|
||||
'status': 'Finished'
|
||||
});
|
||||
print('walletChecked is $walletChecked');
|
||||
if (walletChecked == 'true') {
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'balance': ((-1) * double.parse(paymentAmount)).toString()
|
||||
});
|
||||
}
|
||||
print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
|
||||
if (double.parse(passengerWalletBurc) < 0) {
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
||||
});
|
||||
print(
|
||||
'passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
|
||||
}
|
||||
Future.delayed(const Duration(milliseconds: 300));
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Driver Finish Trip',
|
||||
'you will pay to Driver'.tr + ' $totalCost \$'.tr,
|
||||
tokenPassenger,
|
||||
[
|
||||
box.read(BoxName.driverID),
|
||||
rideId,
|
||||
box.read(BoxName.tokenDriver),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
title: 'You don\'t arrive destenation yet .'.tr,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
totalCost = price.toStringAsFixed(2);
|
||||
paymentAmount = totalCost;
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
// changeRideToBeginToPassenger();
|
||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
'id': rideId,
|
||||
'rideTimeFinish': DateTime.now().toString(),
|
||||
'status': 'Finished'
|
||||
// if (carType != 'Comfort' || carType != 'Free Ride') {
|
||||
// if (distanceToDestination < 50) {
|
||||
isRideFinished = true;
|
||||
isRideStarted = false;
|
||||
isPriceWindow = false;
|
||||
totalCost = price.toStringAsFixed(2);
|
||||
paymentAmount = totalCost;
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
// changeRideToBeginToPassenger();
|
||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
'id': rideId,
|
||||
'rideTimeFinish': DateTime.now().toString(),
|
||||
'status': 'Finished'
|
||||
});
|
||||
print('walletChecked is $walletChecked');
|
||||
if (walletChecked == 'true') {
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'balance': ((-1) * double.parse(paymentAmount)).toString()
|
||||
});
|
||||
print('walletChecked is $walletChecked');
|
||||
if (walletChecked == 'true') {
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'balance': ((-1) * double.parse(paymentAmount)).toString()
|
||||
});
|
||||
}
|
||||
print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
|
||||
if (double.parse(passengerWalletBurc) < 0) {
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
||||
});
|
||||
print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
|
||||
}
|
||||
Future.delayed(const Duration(milliseconds: 300));
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Driver Finish Trip',
|
||||
'you will pay to Driver'.tr + ' $totalCost \$'.tr,
|
||||
tokenPassenger,
|
||||
[
|
||||
box.read(BoxName.driverID),
|
||||
rideId,
|
||||
box.read(BoxName.tokenDriver),
|
||||
],
|
||||
);
|
||||
}
|
||||
print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
|
||||
if (double.parse(passengerWalletBurc) < 0) {
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
||||
});
|
||||
print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
|
||||
}
|
||||
Future.delayed(const Duration(milliseconds: 300));
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Driver Finish Trip',
|
||||
'you will pay to Driver'.tr + ' $totalCost \$'.tr,
|
||||
tokenPassenger,
|
||||
[
|
||||
box.read(BoxName.driverID),
|
||||
rideId,
|
||||
box.read(BoxName.tokenDriver),
|
||||
],
|
||||
);
|
||||
// } else {
|
||||
// Get.defaultDialog(
|
||||
// title: 'You don\'t arrive destenation yet .'.tr,
|
||||
// middleText: '',
|
||||
// confirm: MyElevatedButton(
|
||||
// title: 'Ok'.tr,
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// }));
|
||||
// }
|
||||
// } else {
|
||||
// totalCost = price.toStringAsFixed(2);
|
||||
// paymentAmount = totalCost;
|
||||
// box.write(BoxName.statusDriverLocation, 'off');
|
||||
// // changeRideToBeginToPassenger();
|
||||
// await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
// 'id': rideId,
|
||||
// 'rideTimeFinish': DateTime.now().toString(),
|
||||
// 'status': 'Finished'
|
||||
// });
|
||||
// print('walletChecked is $walletChecked');
|
||||
// if (walletChecked == 'true') {
|
||||
// await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
// 'passenger_id': passengerId,
|
||||
// 'balance': ((-1) * double.parse(paymentAmount)).toString()
|
||||
// });
|
||||
// }
|
||||
// print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
|
||||
// if (double.parse(passengerWalletBurc) < 0) {
|
||||
// await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
// 'passenger_id': passengerId,
|
||||
// 'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
||||
// });
|
||||
// print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
|
||||
// }
|
||||
// Future.delayed(const Duration(milliseconds: 300));
|
||||
// FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
// 'Driver Finish Trip',
|
||||
// 'you will pay to Driver'.tr + ' $totalCost \$'.tr,
|
||||
// tokenPassenger,
|
||||
// [
|
||||
// box.read(BoxName.driverID),
|
||||
// rideId,
|
||||
// box.read(BoxName.tokenDriver),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
// add wallet from passenger from driver
|
||||
Get.to(() => RatePassenger(), arguments: {
|
||||
@@ -616,15 +616,13 @@ class MapDriverController extends GetxController {
|
||||
double recentAngelToMarker = 0;
|
||||
double speed = 0;
|
||||
void updateMarker() async {
|
||||
|
||||
// Remove the existing marker with the ID `MyLocation`.
|
||||
markers.remove( MarkerId('MyLocation'));
|
||||
markers.remove(MarkerId('MyLocation'));
|
||||
|
||||
// Add a new marker with the ID `MyLocation` at the current location of the user.
|
||||
LocationController locationController = Get.find<LocationController>();
|
||||
myLocation = locationController.myLocation;
|
||||
|
||||
|
||||
|
||||
markers.add(
|
||||
Marker(
|
||||
markerId: MarkerId('MyLocation'.tr),
|
||||
|
||||
@@ -129,26 +129,26 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
||||
}
|
||||
|
||||
GetBuilder<MapDriverController> speedCircle() {
|
||||
if (Get.find<MapDriverController>().speed > 100) {
|
||||
if (Platform.isIOS) {
|
||||
HapticFeedback.selectionClick();
|
||||
} else {
|
||||
Vibration.vibrate(duration: 1000);
|
||||
}
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
titleStyle: AppStyle.title,
|
||||
title: 'Speed Over'.tr,
|
||||
middleText: 'Please slow down'.tr,
|
||||
middleTextStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'I will slow down'.tr,
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
);
|
||||
}
|
||||
return GetBuilder<MapDriverController>(
|
||||
builder: (mapDriverController) {
|
||||
if (mapDriverController.speed > 100) {
|
||||
if (Platform.isIOS) {
|
||||
HapticFeedback.selectionClick();
|
||||
} else {
|
||||
Vibration.vibrate(duration: 1000);
|
||||
}
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
titleStyle: AppStyle.title,
|
||||
title: 'Speed Over'.tr,
|
||||
middleText: 'Please slow down'.tr,
|
||||
middleTextStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'I will slow down'.tr,
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
);
|
||||
}
|
||||
return mapDriverController.isRideStarted
|
||||
? Positioned(
|
||||
bottom: 25,
|
||||
|
||||
Reference in New Issue
Block a user