4/2/5
This commit is contained in:
@@ -438,57 +438,11 @@ class MapDriverController extends GetxController {
|
|||||||
Get.find<LocationController>().myLocation.latitude,
|
Get.find<LocationController>().myLocation.latitude,
|
||||||
Get.find<LocationController>().myLocation.longitude,
|
Get.find<LocationController>().myLocation.longitude,
|
||||||
);
|
);
|
||||||
if (carType != 'Comfort' || carType != 'Free Ride') {
|
// if (carType != 'Comfort' || carType != 'Free Ride') {
|
||||||
if (distanceToDestination < 50) {
|
// if (distanceToDestination < 50) {
|
||||||
isRideFinished = true;
|
isRideFinished = true;
|
||||||
isRideStarted = false;
|
isRideStarted = false;
|
||||||
isPriceWindow = 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);
|
totalCost = price.toStringAsFixed(2);
|
||||||
paymentAmount = totalCost;
|
paymentAmount = totalCost;
|
||||||
box.write(BoxName.statusDriverLocation, 'off');
|
box.write(BoxName.statusDriverLocation, 'off');
|
||||||
@@ -524,7 +478,53 @@ class MapDriverController extends GetxController {
|
|||||||
box.read(BoxName.tokenDriver),
|
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
|
// add wallet from passenger from driver
|
||||||
Get.to(() => RatePassenger(), arguments: {
|
Get.to(() => RatePassenger(), arguments: {
|
||||||
@@ -616,15 +616,13 @@ class MapDriverController extends GetxController {
|
|||||||
double recentAngelToMarker = 0;
|
double recentAngelToMarker = 0;
|
||||||
double speed = 0;
|
double speed = 0;
|
||||||
void updateMarker() async {
|
void updateMarker() async {
|
||||||
|
|
||||||
// Remove the existing marker with the ID `MyLocation`.
|
// 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.
|
// Add a new marker with the ID `MyLocation` at the current location of the user.
|
||||||
LocationController locationController = Get.find<LocationController>();
|
LocationController locationController = Get.find<LocationController>();
|
||||||
myLocation = locationController.myLocation;
|
myLocation = locationController.myLocation;
|
||||||
|
|
||||||
|
|
||||||
markers.add(
|
markers.add(
|
||||||
Marker(
|
Marker(
|
||||||
markerId: MarkerId('MyLocation'.tr),
|
markerId: MarkerId('MyLocation'.tr),
|
||||||
|
|||||||
@@ -129,9 +129,7 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetBuilder<MapDriverController> speedCircle() {
|
GetBuilder<MapDriverController> speedCircle() {
|
||||||
return GetBuilder<MapDriverController>(
|
if (Get.find<MapDriverController>().speed > 100) {
|
||||||
builder: (mapDriverController) {
|
|
||||||
if (mapDriverController.speed > 100) {
|
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
HapticFeedback.selectionClick();
|
HapticFeedback.selectionClick();
|
||||||
} else {
|
} else {
|
||||||
@@ -149,6 +147,8 @@ GetBuilder<MapDriverController> speedCircle() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return GetBuilder<MapDriverController>(
|
||||||
|
builder: (mapDriverController) {
|
||||||
return mapDriverController.isRideStarted
|
return mapDriverController.isRideStarted
|
||||||
? Positioned(
|
? Positioned(
|
||||||
bottom: 25,
|
bottom: 25,
|
||||||
|
|||||||
Reference in New Issue
Block a user