diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart index 8c72810..0058b3d 100644 --- a/lib/controller/home/captin/map_driver_controller.dart +++ b/lib/controller/home/captin/map_driver_controller.dart @@ -62,6 +62,7 @@ class MapDriverController extends GetxController { bool isRideFinished = false; bool isRideStarted = false; double passengerInfoWindow = Get.height * .35; + double driverEndPage = 100; double progress = 0; double progressToPassenger = 0; bool isRideBegin = false; @@ -102,6 +103,11 @@ class MapDriverController extends GetxController { update(); } + void changeDriverEndPage() { + remainingTimeTimerRideBegin < 60 ? driverEndPage = 160 : 100; + update(); + } + takeSnapMap() { mapController!.takeSnapshot(); } @@ -226,7 +232,7 @@ class MapDriverController extends GetxController { }); rideIsBeginPassengerTimer(); double pointsSubstraction = 0; - pointsSubstraction = double.parse(paymentAmount) * -1; + pointsSubstraction = double.parse(paymentAmount) * -100; var res = await CRUD().post(link: AppLink.addDriversWallet, payload: { 'paymentID': 'rideId$rideId', 'amount': (pointsSubstraction).toString(), @@ -309,6 +315,7 @@ class MapDriverController extends GetxController { await Future.delayed(const Duration(seconds: 1)); progressTimerRideBegin = i / durationOfRide; remainingTimeTimerRideBegin = durationOfRide - i; + remainingTimeTimerRideBegin < 60 ? driverEndPage = 160 : 100; int minutes = (remainingTimeTimerRideBegin / 60).floor(); int seconds = remainingTimeTimerRideBegin % 60; @@ -429,7 +436,12 @@ class MapDriverController extends GetxController { width: 10, color: AppColor.blueColor, ); - mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 14)); + // final dataBounds = response["routes"][0]["bounds"]; + + // updateCameraFromBoundsAfterGetMap(dataBounds); + +// Fit the camera to the bounds + polyLines.add(polyline); // rideConfirm = false; update(); @@ -468,13 +480,31 @@ class MapDriverController extends GetxController { width: 10, color: AppColor.redColor, ); + // final dataBounds = response["routes"][0]["bounds"]; - polyLinesDestination.add(polyline); + // updateCameraFromBoundsAfterGetMap(dataBounds); + // polyLinesDestination.add(polyline); // rideConfirm = false; update(); } } + void updateCameraFromBoundsAfterGetMap(dynamic response) { + final bounds = response["routes"][0]["bounds"]; + LatLng northeast = + LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); + LatLng southwest = + LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); + +// Create the LatLngBounds object + LatLngBounds boundsData = + LatLngBounds(northeast: northeast, southwest: southwest); + +// Fit the camera to the bounds + var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140); + mapController!.animateCamera(cameraUpdate); + } + void changePassengerInfoWindow() { isPassengerInfoWindow = !isPassengerInfoWindow; passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0; diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart index a2d4712..c924d11 100644 --- a/lib/controller/home/map_passenger_controller.dart +++ b/lib/controller/home/map_passenger_controller.dart @@ -384,7 +384,7 @@ class MapPassengerController extends GetxController { // Format the message. String message = - 'Hi! This is ${box.read(BoxName.name)}. I am using ${box.read(AppInformation.appName)} to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} is driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()} with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}. I am currently located at $passengerLocation. If you need to reach me, please contact the driver directly at $driverPhone.'; + 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $firstName as the driver. $firstName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.'; // Launch the URL to send the SMS. launchCommunication('sms', to, message); @@ -397,7 +397,7 @@ class MapPassengerController extends GetxController { // Format the message. String message = - 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} \nis driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()}\n with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.'; + 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $firstName as the driver. $firstName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.'; // Launch the URL to send the SMS. launchCommunication('whatsapp', to, message); @@ -579,10 +579,25 @@ class MapPassengerController extends GetxController { update(); } + late String driverPhone; + late String firstName; + late String model; + late String licensePlate; changeConfirmRide() async { if (dataCarsLocationByPassenger != 'failure') { driverToken = dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(); + driverPhone = + dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString(); + firstName = dataCarsLocationByPassenger['message'][carsOrder] + ['first_name'] + .toString(); + model = + dataCarsLocationByPassenger['message'][carsOrder]['model'].toString(); + licensePlate = dataCarsLocationByPassenger['message'][carsOrder] + ['license_plate'] + .toString(); + PaymentController paymentController = Get.find(); rideConfirm = true; shouldFetch = true; @@ -601,7 +616,7 @@ class MapPassengerController extends GetxController { "date": DateTime.now().toString(), "time": DateTime.now().toString(), "endtime": durationToAdd.toString(), - "price": totalPassenger.toString(), + "price": totalPassenger.toStringAsFixed(2), "passenger_id": box.read(BoxName.passengerID).toString(), "driver_id": dataCarsLocationByPassenger['message'][carsOrder] ['driver_id'] @@ -1442,23 +1457,28 @@ class MapPassengerController extends GetxController { double lng = points[i][1].toDouble(); polylineCoordinates.add(LatLng(lat, lng)); } +// Define the northeast and southwest coordinates + newStartPointLocation = LatLng( + data[0]["start_location"]['lat'], data[0]["start_location"]['lng']); // Define the northeast and southwest coordinates final bounds = response["routes"][0]["bounds"]; - LatLng northeast = LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); LatLng southwest = LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); - // Create the LatLngBounds object - boundsData = LatLngBounds(northeast: northeast, southwest: southwest); +// Create the LatLngBounds object + LatLngBounds boundsData = + LatLngBounds(northeast: northeast, southwest: southwest); -// Calculate the zoom level based on the distance and screen size +// Fit the camera to the bounds + var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 130); + mapController!.animateCamera(cameraUpdate); // getDistanceFromText(data[0]['distance']['text']); double distanceOfTrip = (data[0]['distance']['value']) / 1000; distance = distanceOfTrip; - updateCameraForDistanceAfterGetMap(); + // updateCameraForDistanceAfterGetMap(); if (polyLines.isNotEmpty) { clearPolyline(); @@ -1506,15 +1526,6 @@ class MapPassengerController extends GetxController { polylineCoordinatesPointsAll[index].add(LatLng(lat, lng)); } // Define the northeast and southwest coordinates - final bounds = response["routes"][0]["bounds"]; - - LatLng northeast = - LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); - LatLng southwest = - LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); - - // Create the LatLngBounds object - boundsData = LatLngBounds(northeast: northeast, southwest: southwest); if (polyLines.isNotEmpty) { // clearPolyline(); @@ -1533,26 +1544,24 @@ class MapPassengerController extends GetxController { } } - updateCameraForDistanceAfterGetMap() { - if (distance <= 5) { - mapController! - .animateCamera(CameraUpdate.newLatLngZoom(newPointLocation0, 14)); - } else if (distance > 5 && distance <= 8) { - mapController! - .animateCamera(CameraUpdate.newLatLngZoom(newPointLocation0, 13)); - } else if (distance > 8 && distance < 16) { - mapController! - .animateCamera(CameraUpdate.newLatLngZoom(newPointLocation0, 12)); - } else if (distance >= 16 && distance < 30) { - mapController! - .animateCamera(CameraUpdate.newLatLngZoom(newPointLocation0, 8)); - } else if (distance >= 30 && distance < 100) { - mapController! - .animateCamera(CameraUpdate.newLatLngZoom(newPointLocation0, 6)); - } else if (distance >= 100) { - mapController! - .animateCamera(CameraUpdate.newLatLngZoom(newPointLocation0, 5)); - } + void updateCameraForDistanceAfterGetMap() { + // Get the non-empty values from the data list + List nonEmptyValues = data + .where((element) => element != null && element.isNotEmpty) + .map((element) => LatLng(element['lat'], element['lng'])) + .toList(); + + // Define the northeast and southwest coordinates + LatLng northeast = nonEmptyValues.first; + LatLng southwest = nonEmptyValues.last; + + // Create the LatLngBounds object + LatLngBounds bounds = + LatLngBounds(northeast: northeast, southwest: southwest); + + // Fit the camera to the bounds + var cameraUpdate = CameraUpdate.newLatLngBounds(bounds, 130); + mapController!.animateCamera(cameraUpdate); update(); } diff --git a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart index f37bea3..17a71d2 100644 --- a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart +++ b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart @@ -15,12 +15,12 @@ GetBuilder driverEndRideBar() { right: 5, child: Container( decoration: AppStyle.boxDecoration, - height: 100, + height: mapDriverController.driverEndPage, width: 200, child: Column( children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( children: [ @@ -31,15 +31,6 @@ GetBuilder driverEndRideBar() { ), ], ), - mapDriverController.remainingTimeTimerRideBegin < 60 - ? MyElevatedButton( - title: 'End Ride'.tr, - onPressed: () { - mapDriverController.finishRideFromDriver(); - }, - kolor: AppColor.redColor, - ) - : const SizedBox(), Column( children: [ const Icon(Icons.timelapse), @@ -48,8 +39,30 @@ GetBuilder driverEndRideBar() { style: AppStyle.title), ], ), + Column( + children: [ + const Icon(Icons.money_sharp), + Text( + '${mapDriverController.paymentAmount} ${'\$'.tr}', + style: AppStyle.title), + ], + ), ], ), + mapDriverController.remainingTimeTimerRideBegin < 60 + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + MyElevatedButton( + title: 'End Ride'.tr, + onPressed: () { + mapDriverController.finishRideFromDriver(); + }, + kolor: AppColor.redColor, + ), + ], + ) + : const SizedBox(), Stack( children: [ LinearProgressIndicator( diff --git a/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart b/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart index 0bc0aea..9e70641 100644 --- a/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart +++ b/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart @@ -24,6 +24,7 @@ class GoogleDriverMap extends StatelessWidget { initialCameraPosition: CameraPosition( target: locationController.myLocation, zoom: 15, + tilt: 40, ), onCameraMove: (position) { locationController.myLocation = position.target; diff --git a/t dataBounds = [] b/t dataBounds = [] new file mode 100644 index 0000000..f81492a --- /dev/null +++ b/t dataBounds = [] @@ -0,0 +1,344 @@ +warning: in the working copy of 'linux/flutter/generated_plugin_registrant.cc', LF will be replaced by CRLF the next time Git touches it +warning: in the working copy of 'linux/flutter/generated_plugin_registrant.h', LF will be replaced by CRLF the next time Git touches it +warning: in the working copy of 'linux/flutter/generated_plugins.cmake', LF will be replaced by CRLF the next time Git touches it +warning: in the working copy of 'macos/Flutter/GeneratedPluginRegistrant.swift', LF will be replaced by CRLF the next time Git touches it +warning: in the working copy of 'windows/flutter/generated_plugin_registrant.cc', LF will be replaced by CRLF the next time Git touches it +warning: in the working copy of 'windows/flutter/generated_plugin_registrant.h', LF will be replaced by CRLF the next time Git touches it +warning: in the working copy of 'windows/flutter/generated_plugins.cmake', LF will be replaced by CRLF the next time Git touches it +diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart +index 8c72810..34875b4 100644 +--- a/lib/controller/home/captin/map_driver_controller.dart ++++ b/lib/controller/home/captin/map_driver_controller.dart +@@ -226,7 +226,7 @@ class MapDriverController extends GetxController { + }); + rideIsBeginPassengerTimer(); + double pointsSubstraction = 0; +- pointsSubstraction = double.parse(paymentAmount) * -1; ++ pointsSubstraction = double.parse(paymentAmount) * -100; + var res = await CRUD().post(link: AppLink.addDriversWallet, payload: { + 'paymentID': 'rideId$rideId', + 'amount': (pointsSubstraction).toString(), +@@ -429,7 +429,12 @@ class MapDriverController extends GetxController { + width: 10, + color: AppColor.blueColor, + ); +- mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 14)); ++ // final dataBounds = response["routes"][0]["bounds"]; ++ ++ // updateCameraFromBoundsAfterGetMap(dataBounds); ++ ++// Fit the camera to the bounds ++ + polyLines.add(polyline); + // rideConfirm = false; + update(); +@@ -468,13 +473,31 @@ class MapDriverController extends GetxController { + width: 10, + color: AppColor.redColor, + ); ++ // final dataBounds = response["routes"][0]["bounds"]; +  +- polyLinesDestination.add(polyline); ++ // updateCameraFromBoundsAfterGetMap(dataBounds); ++ // polyLinesDestination.add(polyline); + // rideConfirm = false; + update(); + } + } +  ++ void updateCameraFromBoundsAfterGetMap(dynamic response) { ++ final bounds = response["routes"][0]["bounds"]; ++ LatLng northeast = ++ LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); ++ LatLng southwest = ++ LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); ++ ++// Create the LatLngBounds object ++ LatLngBounds boundsData = ++ LatLngBounds(northeast: northeast, southwest: southwest); ++ ++// Fit the camera to the bounds ++ var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140); ++ mapController!.animateCamera(cameraUpdate); ++ } ++ + void changePassengerInfoWindow() { + isPassengerInfoWindow = !isPassengerInfoWindow; + passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0; +diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart +index a2d4712..d4adf6f 100644 +--- a/lib/controller/home/map_passenger_controller.dart ++++ b/lib/controller/home/map_passenger_controller.dart +@@ -186,6 +186,7 @@ class MapPassengerController extends GetxController { + late double cost = 0; + late double distance = 0; + late double duration = 0; ++ List dataBounds = []; +  + late Duration durationToAdd; + late DateTime newTime = DateTime.now(); +@@ -218,8 +219,9 @@ class MapPassengerController extends GetxController { + durationToRide = 0; + distanceOfDestnation = 0; + wayPointSheetHeight = 0; +- for (var i = 0; i < Get.find().wayPoints.length; i++) { +- if (placesCoordinate[i + 1].toString() != '') { ++ for (var i = 0; i < placesCoordinate.length; i++) { ++ if (placesCoordinate[i + 1].toString() != '' || ++ placesCoordinate[i + 1].toString() != null) { + await getMapPoints( + placesCoordinate[i].toString(), + placesCoordinate[i + 1].toString(), +@@ -227,7 +229,7 @@ class MapPassengerController extends GetxController { + ); + } + } +- updateCameraForDistanceAfterGetMap(); ++ // updateCameraForDistanceAfterGetMap(); + // isWayPointStopsSheet = false; + if (haveSteps) { + String latestWaypoint = +@@ -378,13 +380,9 @@ class MapPassengerController extends GetxController { + } +  + void sendSMS(String to) async { +- // Get the driver's phone number. +- String driverPhone = +- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString(); +- + // Format the message. + String message = +- 'Hi! This is ${box.read(BoxName.name)}. I am using ${box.read(AppInformation.appName)} to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} is driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()} with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}. I am currently located at $passengerLocation. If you need to reach me, please contact the driver directly at $driverPhone.'; ++ 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $firstName as the driver. $firstName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone .'; +  + // Launch the URL to send the SMS. + launchCommunication('sms', to, message); +@@ -392,12 +390,10 @@ class MapPassengerController extends GetxController { +  + void sendWhatsapp(String to) async { + // Get the driver's phone number. +- String driverPhone = +- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString(); +  + // Format the message. + String message = +- 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} \nis driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()}\n with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.'; ++ 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $firstName as the driver. $firstName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone .'; +  + // Launch the URL to send the SMS. + launchCommunication('whatsapp', to, message); +@@ -444,6 +440,44 @@ class MapPassengerController extends GetxController { + } + } +  ++ // void startTimerToPassengerFromDriverAfterApplied() async { ++ // for (int i = 0; i <= timeToPassengerFromDriverAfterApplied; i++) { ++ // await Future.delayed(const Duration(seconds: 1)); ++ // progressTimerToPassengerFromDriverAfterApplied = ++ // i / timeToPassengerFromDriverAfterApplied; ++ // remainingTimeToPassengerFromDriverAfterApplied = ++ // timeToPassengerFromDriverAfterApplied - i; ++ ++ // var response = await CRUD().post( ++ // link: AppLink.addAdminUser, ////////change to nnew endpoint ++ // payload: { ++ // 'ride_id': rideId, ++ // 'time_to_passenger_from_driver_after_applied': ++ // timeToPassengerFromDriverAfterApplied, ++ // }); ++ ++ // if (response.statusCode == 200) { ++ // // Update progress and remaining time ++ // int minutes = ++ // (remainingTimeToPassengerFromDriverAfterApplied / 60).floor(); ++ // int seconds = remainingTimeToPassengerFromDriverAfterApplied % 60; ++ // stringRemainingTimeToPassenger = ++ // '$minutes:${seconds.toString().padLeft(2, '0')}'; ++ // update(); ++ ++ // if (remainingTimeToPassengerFromDriverAfterApplied < 69) { ++ // if (rideTimerBegin == false) { ++ // getBeginRideFromDriver(); ++ // } ++ // } ++ // } else { ++ // // Handle error ++ // print( ++ // 'Error updating time to passenger: ${response.statusCode} ${response.reasonPhrase} ${response.body}'); ++ // } ++ // } ++ // } ++ + // Create a StreamController to manage the timer values + final timerController = StreamController(); +  +@@ -579,10 +613,24 @@ class MapPassengerController extends GetxController { + update(); + } +  ++ late String driverPhone; ++ late String firstName; ++ late String model; ++ late String licensePlate; + changeConfirmRide() async { + if (dataCarsLocationByPassenger != 'failure') { + driverToken = + dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(); ++ driverPhone = ++ dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString(); ++ firstName = dataCarsLocationByPassenger['message'][carsOrder] ++ ['first_name'] ++ .toString(); ++ model = ++ dataCarsLocationByPassenger['message'][carsOrder]['model'].toString(); ++ licensePlate = dataCarsLocationByPassenger['message'][carsOrder] ++ ['license_plate'] ++ .toString(); + PaymentController paymentController = Get.find(); + rideConfirm = true; + shouldFetch = true; +@@ -617,9 +665,9 @@ class MapPassengerController extends GetxController { + List body = [ + '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}', + '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}', +- totalPassenger.toString(), ++ totalPassenger.toStringAsFixed(2), + totalDriver.toString(), +- duration.toString(), ++ Duration(seconds: durationToRide).toString(), + distance.toString(), + dataCarsLocationByPassenger['message'][carsOrder]['driver_id'] + .toString(), +@@ -1442,23 +1490,29 @@ class MapPassengerController extends GetxController { + double lng = points[i][1].toDouble(); + polylineCoordinates.add(LatLng(lat, lng)); + } ++ newStartPointLocation = LatLng( ++ data[0]["start_location"]['lat'], data[0]["start_location"]['lng']); + // Define the northeast and southwest coordinates + final bounds = response["routes"][0]["bounds"]; +- + LatLng northeast = + LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); + LatLng southwest = + LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); +  +- // Create the LatLngBounds object +- boundsData = LatLngBounds(northeast: northeast, southwest: southwest); ++// Create the LatLngBounds object ++ LatLngBounds boundsData = ++ LatLngBounds(northeast: northeast, southwest: southwest); ++ ++// Fit the camera to the bounds ++ var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 130); ++ mapController!.animateCamera(cameraUpdate); +  + // Calculate the zoom level based on the distance and screen size +  + // getDistanceFromText(data[0]['distance']['text']); + double distanceOfTrip = (data[0]['distance']['value']) / 1000; + distance = distanceOfTrip; +- updateCameraForDistanceAfterGetMap(); ++ // updateCameraForDistanceAfterGetMap(); +  + if (polyLines.isNotEmpty) { + clearPolyline(); +@@ -1506,15 +1560,6 @@ class MapPassengerController extends GetxController { + polylineCoordinatesPointsAll[index].add(LatLng(lat, lng)); + } + // Define the northeast and southwest coordinates +- final bounds = response["routes"][0]["bounds"]; +- +- LatLng northeast = +- LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); +- LatLng southwest = +- LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); +- +- // Create the LatLngBounds object +- boundsData = LatLngBounds(northeast: northeast, southwest: southwest); +  + if (polyLines.isNotEmpty) { + // clearPolyline(); +@@ -1533,6 +1578,22 @@ class MapPassengerController extends GetxController { + } + } +  ++ void updateCameraFromBoundsAfterGetMap(dynamic response) { ++ final bounds = response["routes"][0]["bounds"]; ++ LatLng northeast = ++ LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']); ++ LatLng southwest = ++ LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']); ++ ++// Create the LatLngBounds object ++ LatLngBounds boundsData = ++ LatLngBounds(northeast: northeast, southwest: southwest); ++ ++// Fit the camera to the bounds ++ var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140); ++ mapController!.animateCamera(cameraUpdate); ++ } ++ + updateCameraForDistanceAfterGetMap() { + if (distance <= 5) { + mapController! +diff --git a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart +index f37bea3..eb5e3a0 100644 +--- a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart ++++ b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart +@@ -20,7 +20,7 @@ GetBuilder driverEndRideBar() { + child: Column( + children: [ + Row( +- mainAxisAlignment: MainAxisAlignment.spaceAround, ++ mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + children: [ +@@ -31,15 +31,6 @@ GetBuilder driverEndRideBar() { + ), + ], + ), +- mapDriverController.remainingTimeTimerRideBegin < 60 +- ? MyElevatedButton( +- title: 'End Ride'.tr, +- onPressed: () { +- mapDriverController.finishRideFromDriver(); +- }, +- kolor: AppColor.redColor, +- ) +- : const SizedBox(), + Column( + children: [ + const Icon(Icons.timelapse), +@@ -48,8 +39,30 @@ GetBuilder driverEndRideBar() { + style: AppStyle.title), + ], + ), ++ Column( ++ children: [ ++ const Icon(Icons.money_sharp), ++ Text( ++ '${mapDriverController.paymentAmount} ${'\$'.tr}', ++ style: AppStyle.title), ++ ], ++ ), + ], + ), ++ mapDriverController.remainingTimeTimerRideBegin < 60 ++ ? Row( ++ mainAxisAlignment: MainAxisAlignment.center, ++ children: [ ++ MyElevatedButton( ++ title: 'End Ride'.tr, ++ onPressed: () { ++ mapDriverController.finishRideFromDriver(); ++ }, ++ kolor: AppColor.redColor, ++ ), ++ ], ++ ) ++ : const SizedBox(), + Stack( + children: [ + LinearProgressIndicator(