This commit is contained in:
Hamza-Ayed
2023-12-31 14:54:28 +03:00
parent ee41f87b69
commit 8475bdc831
7 changed files with 158 additions and 165 deletions

View File

@@ -103,6 +103,18 @@ class MapPassengerController extends GetxController {
late String driverToken;
int carsOrder = 0;
String? mapAPIKEY;
late double totalME = 0;
late double tax = 0;
late double totalPassenger = 0;
late double totalDriver = 0;
late double averageDuration = 0;
late double costDuration = 0;
late double cost = 0;
late double distance = 0;
late double duration = 0;
late Duration durationToAdd;
late DateTime newTime = DateTime.now();
void onChangedPassengerCount(int newValue) {
selectedPassengerCount = newValue;
@@ -116,6 +128,7 @@ class MapPassengerController extends GetxController {
void getCurrentLocationFormString() async {
currentLocationToFormPlaces = true;
currentLocationString = 'Waiting for your location'.tr;
await getLocation();
currentLocationString = myLocation.toString();
newStartPointLocation = myLocation;
@@ -401,7 +414,7 @@ class MapPassengerController extends GetxController {
update();
} else {
Get.defaultDialog(
title: 'No Car or Captain Found in your area.'.tr,
title: 'No Car or Driver Found in your area.'.tr,
titleStyle: AppStyle.title,
middleText: 'Please Try anther time '.tr,
middleTextStyle: AppStyle.title.copyWith(color: AppColor.yellowColor),
@@ -436,7 +449,7 @@ class MapPassengerController extends GetxController {
changeConfirmRide();
} else {
Get.defaultDialog(
title: 'There no Captain Aplly your order sorry for that '.tr,
title: 'There no Driver Aplly your order sorry for that '.tr,
middleText: 'try next time .',
confirm: MyElevatedButton(
title: 'Back',
@@ -503,30 +516,19 @@ class MapPassengerController extends GetxController {
var res =
await CRUD().get(link: AppLink.getCarsLocationByPassenger, payload: {
'southwestLat': southwest.latitude.toString(),
'southwestLon': southwest.longitude.toString(),
'northeastLat': northeast.latitude.toString(),
'northeastLon': northeast.longitude.toString(),
'southwestLat': bounds.southwest.latitude.toString(),
'southwestLon': bounds.southwest.longitude.toString(),
'northeastLat': bounds.northeast.latitude.toString(),
'northeastLon': bounds.northeast.longitude.toString(),
});
if (res == 'failure') {
noCarString = true;
dataCarsLocationByPassenger = res;
update();
// Get.snackbar('No Car in your site.Sorry!'.tr, '',
// backgroundColor: AppColor.redColor);
// Get.defaultDialog(
// title: 'No Car in your site.Sorry!'.tr,
// middleText: '',
// confirm: MyElevatedButton(
// title: 'Back',
// onPressed: () {
// Get.back();
// markerReloadingTimer.cancel();
// }));
} else {
noCarString = false;
dataCarsLocationByPassenger = jsonDecode(res);
// print(dataCarsLocationByPassenger);
print(dataCarsLocationByPassenger);
// if (dataCarsLocationByPassenger.length > carsOrder) {
driverId = dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
.toString();
@@ -569,7 +571,7 @@ class MapPassengerController extends GetxController {
Future runEvery30SecondsUntilConditionMet() async {
// Calculate the duration of the trip in minutes.
double tripDurationInMinutes = duration1 / 30;
double tripDurationInMinutes = duration1 / 20;
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++) {
@@ -769,7 +771,7 @@ class MapPassengerController extends GetxController {
ImageConfiguration config = ImageConfiguration(
size: Size(Get.width * .6, Get.height * .6),
);
BitmapDescriptor.fromAssetImage(config, 'assets/images/picker.png')
BitmapDescriptor.fromAssetImage(config, 'assets/images/brand.png')
.then((value) {
tripIcon = value;
update();
@@ -1133,18 +1135,6 @@ class MapPassengerController extends GetxController {
return distance;
}
late double totalME = 0;
late double tax = 0;
late double totalPassenger = 0;
late double totalDriver = 0;
late double averageDuration = 0;
late double costDuration = 0;
late double cost = 0;
late double distance = 0;
late double duration = 0;
late Duration durationToAdd;
late DateTime newTime = DateTime.now();
Future bottomSheet() async {
if (data.isNotEmpty) {
String distanceText = await data[0]['distance']['text'];