This commit is contained in:
Hamza-Ayed
2023-08-21 00:07:08 +03:00
parent 6a3865a3d1
commit b340316e11
13 changed files with 515 additions and 82 deletions

View File

@@ -48,10 +48,11 @@ class MapController extends GetxController {
bool isMainBottomMenuMap = true;
double heightButtomSheetShown = 300;
double cashConfirmPageShown = 250;
double paymentPageShown = 380;
double paymentPageShown = Get.height * .6;
late final LatLng southwest;
late final LatLng northeast;
List<CarLocationModel> carLocations = <CarLocationModel>[];
// final mainBottomMenuMap = GlobalKey<AnimatedContainer>();
void changeButtomSheetShown() {
isButtomSheetShown = !isButtomSheetShown;
@@ -341,9 +342,9 @@ class MapController extends GetxController {
// Animate the camera to the adjusted bounds
if (distanceOfDestnation <= 10) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 14));
} else if (distanceOfDestnation > 10 && distanceOfDestnation < 16) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 12));
} else if (distanceOfDestnation > 10 && distanceOfDestnation < 16) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 11));
} else if (distanceOfDestnation > 16 && distanceOfDestnation < 30) {
mapController!.animateCamera(CameraUpdate.newLatLngZoom(mylocation, 10));
} else if (distanceOfDestnation > 30 && distanceOfDestnation < 100) {
@@ -376,18 +377,18 @@ class MapController extends GetxController {
return distance;
}
late double totaME;
late double tax;
late double totalPassenger;
late double totalDriver;
late double averageDuration;
late double costDuration;
late double cost;
late double distance;
late double duration;
late double totaME = 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 = 2;
DateTime currentTime = DateTime.now();
late Duration durationToAdd;
late DateTime newTime;
late DateTime newTime = DateTime.now();
void bottomSheet() {
if (data.isNotEmpty) {
String distanceText = data[0]['distance']['text'];
@@ -395,12 +396,25 @@ class MapController extends GetxController {
distance = getDistanceFromText(distanceText);
duration = getDistanceFromText(durationText);
durationToAdd = Duration(minutes: duration.toInt());
DateTime currentTime = DateTime.now();
newTime = currentTime.add(durationToAdd);
if (distanceText.contains('km')) {
cost = distance * 0.21;
update();
if (currentTime.hour >= 21) {
if (distanceText.contains('km')) {
cost = distance * 0.23;
update();
} else {
cost = distance * 0.23 / 1000;
update();
}
} else {
cost = distance * 0.21 / 1000;
if (distanceText.contains('km')) {
cost = distance * 0.21;
update();
} else {
cost = distance * 0.21 / 1000;
update();
}
}
averageDuration = duration / distance;
costDuration = duration * averageDuration * 0.016;
@@ -410,12 +424,15 @@ class MapController extends GetxController {
totaME = totalPassenger - totalDriver - tax;
if (totalPassenger < 1) {
totalPassenger = 1;
update();
if (totalDriver < .5) {
totalDriver = .85;
totaME = .11;
update();
} else {
totalDriver = .95;
totaME = .05;
update();
}
}
}