This commit is contained in:
Hamza-Ayed
2024-01-18 00:49:00 +03:00
parent 358bb904ab
commit 7af7e71b30
17 changed files with 1028 additions and 269 deletions

View File

@@ -31,11 +31,17 @@ class MapDriverController extends GetxController {
Set<Marker> markers = {};
late String passengerLocation;
late String passengerDestination;
late String step0;
late String step1;
late String step2;
late String step3;
late String step4;
late String duration;
late String distance;
late String name;
late String phone;
late String rideId;
late String isHaveSteps;
late String paymentAmount;
late String paymentMethod;
late String passengerId;
@@ -311,20 +317,15 @@ class MapDriverController extends GetxController {
),
);
// Update the `markers` set and call the `update()` method on the controller to notify the view that the marker position has changed.
update();
// No recursive call here. The marker update will be triggered externally.
// Optionally, you can animate the camera to the new location after updating the marker.
mapController!.animateCamera(
CameraUpdate.newLatLng(locationController.myLocation),
);
update();
}
void addCustomCarIcon() {
ImageConfiguration config = ImageConfiguration(
size: Size(Get.width * .6, Get.height * .6),
ImageConfiguration config = const ImageConfiguration(
size: Size(20, 20),
// scale: 1.0,
);
BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png')
@@ -441,13 +442,25 @@ class MapDriverController extends GetxController {
rideId = Get.arguments['rideId'];
durationOfRideValue = Get.arguments['durationOfRideValue'];
paymentAmount = Get.arguments['paymentAmount'];
paymentMethod = Get.arguments['paymentMethod'];
isHaveSteps = Get.arguments['isHaveSteps'];
step0 = Get.arguments['step0'];
step1 = Get.arguments['step1'];
step2 = Get.arguments['step2'];
step3 = Get.arguments['step3'];
step4 = Get.arguments['step4'];
String lat = Get.find<LocationController>().myLocation.latitude.toString();
String lng = Get.find<LocationController>().myLocation.longitude.toString();
String origin = '$lat,$lng';
// Set the origin and destination coordinates for the Google Maps directions request.
getMap(origin, passengerLocation);
await getMapDestination(passengerLocation, passengerDestination);
isHaveSteps == 'haveSteps'
? (
await getMapDestination(step0, step1),
await getMapDestination(step1, step2),
await getMapDestination(step2, step3),
await getMapDestination(step3, step4),
)
: await getMapDestination(passengerLocation, passengerDestination);
addCustomCarIcon();
// updateMarker();
startTimerToShowPassengerInfoWindowFromDriver();