345 lines
19 KiB
Plaintext
345 lines
19 KiB
Plaintext
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
|
||
[1mdiff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart[m
|
||
[1mindex 8c72810..34875b4 100644[m
|
||
[1m--- a/lib/controller/home/captin/map_driver_controller.dart[m
|
||
[1m+++ b/lib/controller/home/captin/map_driver_controller.dart[m
|
||
[36m@@ -226,7 +226,7 @@[m [mclass MapDriverController extends GetxController {[m
|
||
});[m
|
||
rideIsBeginPassengerTimer();[m
|
||
double pointsSubstraction = 0;[m
|
||
[31m- pointsSubstraction = double.parse(paymentAmount) * -1;[m
|
||
[32m+[m[32m pointsSubstraction = double.parse(paymentAmount) * -100;[m
|
||
var res = await CRUD().post(link: AppLink.addDriversWallet, payload: {[m
|
||
'paymentID': 'rideId$rideId',[m
|
||
'amount': (pointsSubstraction).toString(),[m
|
||
[36m@@ -429,7 +429,12 @@[m [mclass MapDriverController extends GetxController {[m
|
||
width: 10,[m
|
||
color: AppColor.blueColor,[m
|
||
);[m
|
||
[31m- mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 14));[m
|
||
[32m+[m[32m // final dataBounds = response["routes"][0]["bounds"];[m
|
||
[32m+[m
|
||
[32m+[m[32m // updateCameraFromBoundsAfterGetMap(dataBounds);[m
|
||
[32m+[m
|
||
[32m+[m[32m// Fit the camera to the bounds[m
|
||
[32m+[m
|
||
polyLines.add(polyline);[m
|
||
// rideConfirm = false;[m
|
||
update();[m
|
||
[36m@@ -468,13 +473,31 @@[m [mclass MapDriverController extends GetxController {[m
|
||
width: 10,[m
|
||
color: AppColor.redColor,[m
|
||
);[m
|
||
[32m+[m[32m // final dataBounds = response["routes"][0]["bounds"];[m
|
||
[m
|
||
[31m- polyLinesDestination.add(polyline);[m
|
||
[32m+[m[32m // updateCameraFromBoundsAfterGetMap(dataBounds);[m
|
||
[32m+[m[32m // polyLinesDestination.add(polyline);[m
|
||
// rideConfirm = false;[m
|
||
update();[m
|
||
}[m
|
||
}[m
|
||
[m
|
||
[32m+[m[32m void updateCameraFromBoundsAfterGetMap(dynamic response) {[m
|
||
[32m+[m[32m final bounds = response["routes"][0]["bounds"];[m
|
||
[32m+[m[32m LatLng northeast =[m
|
||
[32m+[m[32m LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);[m
|
||
[32m+[m[32m LatLng southwest =[m
|
||
[32m+[m[32m LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);[m
|
||
[32m+[m
|
||
[32m+[m[32m// Create the LatLngBounds object[m
|
||
[32m+[m[32m LatLngBounds boundsData =[m
|
||
[32m+[m[32m LatLngBounds(northeast: northeast, southwest: southwest);[m
|
||
[32m+[m
|
||
[32m+[m[32m// Fit the camera to the bounds[m
|
||
[32m+[m[32m var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140);[m
|
||
[32m+[m[32m mapController!.animateCamera(cameraUpdate);[m
|
||
[32m+[m[32m }[m
|
||
[32m+[m
|
||
void changePassengerInfoWindow() {[m
|
||
isPassengerInfoWindow = !isPassengerInfoWindow;[m
|
||
passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0;[m
|
||
[1mdiff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart[m
|
||
[1mindex a2d4712..d4adf6f 100644[m
|
||
[1m--- a/lib/controller/home/map_passenger_controller.dart[m
|
||
[1m+++ b/lib/controller/home/map_passenger_controller.dart[m
|
||
[36m@@ -186,6 +186,7 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
late double cost = 0;[m
|
||
late double distance = 0;[m
|
||
late double duration = 0;[m
|
||
[32m+[m[32m List dataBounds = [];[m
|
||
[m
|
||
late Duration durationToAdd;[m
|
||
late DateTime newTime = DateTime.now();[m
|
||
[36m@@ -218,8 +219,9 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
durationToRide = 0;[m
|
||
distanceOfDestnation = 0;[m
|
||
wayPointSheetHeight = 0;[m
|
||
[31m- for (var i = 0; i < Get.find<WayPointController>().wayPoints.length; i++) {[m
|
||
[31m- if (placesCoordinate[i + 1].toString() != '') {[m
|
||
[32m+[m[32m for (var i = 0; i < placesCoordinate.length; i++) {[m
|
||
[32m+[m[32m if (placesCoordinate[i + 1].toString() != '' ||[m
|
||
[32m+[m[32m placesCoordinate[i + 1].toString() != null) {[m
|
||
await getMapPoints([m
|
||
placesCoordinate[i].toString(),[m
|
||
placesCoordinate[i + 1].toString(),[m
|
||
[36m@@ -227,7 +229,7 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
);[m
|
||
}[m
|
||
}[m
|
||
[31m- updateCameraForDistanceAfterGetMap();[m
|
||
[32m+[m[32m // updateCameraForDistanceAfterGetMap();[m
|
||
// isWayPointStopsSheet = false;[m
|
||
if (haveSteps) {[m
|
||
String latestWaypoint =[m
|
||
[36m@@ -378,13 +380,9 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
}[m
|
||
[m
|
||
void sendSMS(String to) async {[m
|
||
[31m- // Get the driver's phone number.[m
|
||
[31m- String driverPhone =[m
|
||
[31m- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();[m
|
||
[31m-[m
|
||
// Format the message.[m
|
||
String message =[m
|
||
[31m- '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.';[m
|
||
[32m+[m[32m '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 .';[m
|
||
[m
|
||
// Launch the URL to send the SMS.[m
|
||
launchCommunication('sms', to, message);[m
|
||
[36m@@ -392,12 +390,10 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
[m
|
||
void sendWhatsapp(String to) async {[m
|
||
// Get the driver's phone number.[m
|
||
[31m- String driverPhone =[m
|
||
[31m- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();[m
|
||
[m
|
||
// Format the message.[m
|
||
String message =[m
|
||
[31m- '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.';[m
|
||
[32m+[m[32m '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 .';[m
|
||
[m
|
||
// Launch the URL to send the SMS.[m
|
||
launchCommunication('whatsapp', to, message);[m
|
||
[36m@@ -444,6 +440,44 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
}[m
|
||
}[m
|
||
[m
|
||
[32m+[m[32m // void startTimerToPassengerFromDriverAfterApplied() async {[m
|
||
[32m+[m[32m // for (int i = 0; i <= timeToPassengerFromDriverAfterApplied; i++) {[m
|
||
[32m+[m[32m // await Future.delayed(const Duration(seconds: 1));[m
|
||
[32m+[m[32m // progressTimerToPassengerFromDriverAfterApplied =[m
|
||
[32m+[m[32m // i / timeToPassengerFromDriverAfterApplied;[m
|
||
[32m+[m[32m // remainingTimeToPassengerFromDriverAfterApplied =[m
|
||
[32m+[m[32m // timeToPassengerFromDriverAfterApplied - i;[m
|
||
[32m+[m
|
||
[32m+[m[32m // var response = await CRUD().post([m
|
||
[32m+[m[32m // link: AppLink.addAdminUser, ////////change to nnew endpoint[m
|
||
[32m+[m[32m // payload: {[m
|
||
[32m+[m[32m // 'ride_id': rideId,[m
|
||
[32m+[m[32m // 'time_to_passenger_from_driver_after_applied':[m
|
||
[32m+[m[32m // timeToPassengerFromDriverAfterApplied,[m
|
||
[32m+[m[32m // });[m
|
||
[32m+[m
|
||
[32m+[m[32m // if (response.statusCode == 200) {[m
|
||
[32m+[m[32m // // Update progress and remaining time[m
|
||
[32m+[m[32m // int minutes =[m
|
||
[32m+[m[32m // (remainingTimeToPassengerFromDriverAfterApplied / 60).floor();[m
|
||
[32m+[m[32m // int seconds = remainingTimeToPassengerFromDriverAfterApplied % 60;[m
|
||
[32m+[m[32m // stringRemainingTimeToPassenger =[m
|
||
[32m+[m[32m // '$minutes:${seconds.toString().padLeft(2, '0')}';[m
|
||
[32m+[m[32m // update();[m
|
||
[32m+[m
|
||
[32m+[m[32m // if (remainingTimeToPassengerFromDriverAfterApplied < 69) {[m
|
||
[32m+[m[32m // if (rideTimerBegin == false) {[m
|
||
[32m+[m[32m // getBeginRideFromDriver();[m
|
||
[32m+[m[32m // }[m
|
||
[32m+[m[32m // }[m
|
||
[32m+[m[32m // } else {[m
|
||
[32m+[m[32m // // Handle error[m
|
||
[32m+[m[32m // print([m
|
||
[32m+[m[32m // 'Error updating time to passenger: ${response.statusCode} ${response.reasonPhrase} ${response.body}');[m
|
||
[32m+[m[32m // }[m
|
||
[32m+[m[32m // }[m
|
||
[32m+[m[32m // }[m
|
||
[32m+[m
|
||
// Create a StreamController to manage the timer values[m
|
||
final timerController = StreamController<int>();[m
|
||
[m
|
||
[36m@@ -579,10 +613,24 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
update();[m
|
||
}[m
|
||
[m
|
||
[32m+[m[32m late String driverPhone;[m
|
||
[32m+[m[32m late String firstName;[m
|
||
[32m+[m[32m late String model;[m
|
||
[32m+[m[32m late String licensePlate;[m
|
||
changeConfirmRide() async {[m
|
||
if (dataCarsLocationByPassenger != 'failure') {[m
|
||
driverToken =[m
|
||
dataCarsLocationByPassenger['message'][carsOrder]['token'].toString();[m
|
||
[32m+[m[32m driverPhone =[m
|
||
[32m+[m[32m dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();[m
|
||
[32m+[m[32m firstName = dataCarsLocationByPassenger['message'][carsOrder][m
|
||
[32m+[m[32m ['first_name'][m
|
||
[32m+[m[32m .toString();[m
|
||
[32m+[m[32m model =[m
|
||
[32m+[m[32m dataCarsLocationByPassenger['message'][carsOrder]['model'].toString();[m
|
||
[32m+[m[32m licensePlate = dataCarsLocationByPassenger['message'][carsOrder][m
|
||
[32m+[m[32m ['license_plate'][m
|
||
[32m+[m[32m .toString();[m
|
||
PaymentController paymentController = Get.find<PaymentController>();[m
|
||
rideConfirm = true;[m
|
||
shouldFetch = true;[m
|
||
[36m@@ -617,9 +665,9 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
List<String> body = [[m
|
||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',[m
|
||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',[m
|
||
[31m- totalPassenger.toString(),[m
|
||
[32m+[m[32m totalPassenger.toStringAsFixed(2),[m
|
||
totalDriver.toString(),[m
|
||
[31m- duration.toString(),[m
|
||
[32m+[m[32m Duration(seconds: durationToRide).toString(),[m
|
||
distance.toString(),[m
|
||
dataCarsLocationByPassenger['message'][carsOrder]['driver_id'][m
|
||
.toString(),[m
|
||
[36m@@ -1442,23 +1490,29 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
double lng = points[i][1].toDouble();[m
|
||
polylineCoordinates.add(LatLng(lat, lng));[m
|
||
}[m
|
||
[32m+[m[32m newStartPointLocation = LatLng([m
|
||
[32m+[m[32m data[0]["start_location"]['lat'], data[0]["start_location"]['lng']);[m
|
||
// Define the northeast and southwest coordinates[m
|
||
final bounds = response["routes"][0]["bounds"];[m
|
||
[31m-[m
|
||
LatLng northeast =[m
|
||
LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);[m
|
||
LatLng southwest =[m
|
||
LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);[m
|
||
[m
|
||
[31m- // Create the LatLngBounds object[m
|
||
[31m- boundsData = LatLngBounds(northeast: northeast, southwest: southwest);[m
|
||
[32m+[m[32m// Create the LatLngBounds object[m
|
||
[32m+[m[32m LatLngBounds boundsData =[m
|
||
[32m+[m[32m LatLngBounds(northeast: northeast, southwest: southwest);[m
|
||
[32m+[m
|
||
[32m+[m[32m// Fit the camera to the bounds[m
|
||
[32m+[m[32m var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 130);[m
|
||
[32m+[m[32m mapController!.animateCamera(cameraUpdate);[m
|
||
[m
|
||
// Calculate the zoom level based on the distance and screen size[m
|
||
[m
|
||
// getDistanceFromText(data[0]['distance']['text']);[m
|
||
double distanceOfTrip = (data[0]['distance']['value']) / 1000;[m
|
||
distance = distanceOfTrip;[m
|
||
[31m- updateCameraForDistanceAfterGetMap();[m
|
||
[32m+[m[32m // updateCameraForDistanceAfterGetMap();[m
|
||
[m
|
||
if (polyLines.isNotEmpty) {[m
|
||
clearPolyline();[m
|
||
[36m@@ -1506,15 +1560,6 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
polylineCoordinatesPointsAll[index].add(LatLng(lat, lng));[m
|
||
}[m
|
||
// Define the northeast and southwest coordinates[m
|
||
[31m- final bounds = response["routes"][0]["bounds"];[m
|
||
[31m-[m
|
||
[31m- LatLng northeast =[m
|
||
[31m- LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);[m
|
||
[31m- LatLng southwest =[m
|
||
[31m- LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);[m
|
||
[31m-[m
|
||
[31m- // Create the LatLngBounds object[m
|
||
[31m- boundsData = LatLngBounds(northeast: northeast, southwest: southwest);[m
|
||
[m
|
||
if (polyLines.isNotEmpty) {[m
|
||
// clearPolyline();[m
|
||
[36m@@ -1533,6 +1578,22 @@[m [mclass MapPassengerController extends GetxController {[m
|
||
}[m
|
||
}[m
|
||
[m
|
||
[32m+[m[32m void updateCameraFromBoundsAfterGetMap(dynamic response) {[m
|
||
[32m+[m[32m final bounds = response["routes"][0]["bounds"];[m
|
||
[32m+[m[32m LatLng northeast =[m
|
||
[32m+[m[32m LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);[m
|
||
[32m+[m[32m LatLng southwest =[m
|
||
[32m+[m[32m LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);[m
|
||
[32m+[m
|
||
[32m+[m[32m// Create the LatLngBounds object[m
|
||
[32m+[m[32m LatLngBounds boundsData =[m
|
||
[32m+[m[32m LatLngBounds(northeast: northeast, southwest: southwest);[m
|
||
[32m+[m
|
||
[32m+[m[32m// Fit the camera to the bounds[m
|
||
[32m+[m[32m var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140);[m
|
||
[32m+[m[32m mapController!.animateCamera(cameraUpdate);[m
|
||
[32m+[m[32m }[m
|
||
[32m+[m
|
||
updateCameraForDistanceAfterGetMap() {[m
|
||
if (distance <= 5) {[m
|
||
mapController![m
|
||
[1mdiff --git a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart[m
|
||
[1mindex f37bea3..eb5e3a0 100644[m
|
||
[1m--- a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart[m
|
||
[1m+++ b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart[m
|
||
[36m@@ -20,7 +20,7 @@[m [mGetBuilder<MapDriverController> driverEndRideBar() {[m
|
||
child: Column([m
|
||
children: [[m
|
||
Row([m
|
||
[31m- mainAxisAlignment: MainAxisAlignment.spaceAround,[m
|
||
[32m+[m[32m mainAxisAlignment: MainAxisAlignment.spaceEvenly,[m
|
||
children: [[m
|
||
Column([m
|
||
children: [[m
|
||
[36m@@ -31,15 +31,6 @@[m [mGetBuilder<MapDriverController> driverEndRideBar() {[m
|
||
),[m
|
||
],[m
|
||
),[m
|
||
[31m- mapDriverController.remainingTimeTimerRideBegin < 60[m
|
||
[31m- ? MyElevatedButton([m
|
||
[31m- title: 'End Ride'.tr,[m
|
||
[31m- onPressed: () {[m
|
||
[31m- mapDriverController.finishRideFromDriver();[m
|
||
[31m- },[m
|
||
[31m- kolor: AppColor.redColor,[m
|
||
[31m- )[m
|
||
[31m- : const SizedBox(),[m
|
||
Column([m
|
||
children: [[m
|
||
const Icon(Icons.timelapse),[m
|
||
[36m@@ -48,8 +39,30 @@[m [mGetBuilder<MapDriverController> driverEndRideBar() {[m
|
||
style: AppStyle.title),[m
|
||
],[m
|
||
),[m
|
||
[32m+[m[32m Column([m
|
||
[32m+[m[32m children: [[m
|
||
[32m+[m[32m const Icon(Icons.money_sharp),[m
|
||
[32m+[m[32m Text([m
|
||
[32m+[m[32m '${mapDriverController.paymentAmount} ${'\$'.tr}',[m
|
||
[32m+[m[32m style: AppStyle.title),[m
|
||
[32m+[m[32m ],[m
|
||
[32m+[m[32m ),[m
|
||
],[m
|
||
),[m
|
||
[32m+[m[32m mapDriverController.remainingTimeTimerRideBegin < 60[m
|
||
[32m+[m[32m ? Row([m
|
||
[32m+[m[32m mainAxisAlignment: MainAxisAlignment.center,[m
|
||
[32m+[m[32m children: [[m
|
||
[32m+[m[32m MyElevatedButton([m
|
||
[32m+[m[32m title: 'End Ride'.tr,[m
|
||
[32m+[m[32m onPressed: () {[m
|
||
[32m+[m[32m mapDriverController.finishRideFromDriver();[m
|
||
[32m+[m[32m },[m
|
||
[32m+[m[32m kolor: AppColor.redColor,[m
|
||
[32m+[m[32m ),[m
|
||
[32m+[m[32m ],[m
|
||
[32m+[m[32m )[m
|
||
[32m+[m[32m : const SizedBox(),[m
|
||
Stack([m
|
||
children: [[m
|
||
LinearProgressIndicator([m
|