1/27/2
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<PaymentController>();
|
||||
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<LatLng> 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ GetBuilder<MapDriverController> 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<MapDriverController> 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<MapDriverController> 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(
|
||||
|
||||
@@ -24,6 +24,7 @@ class GoogleDriverMap extends StatelessWidget {
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: locationController.myLocation,
|
||||
zoom: 15,
|
||||
tilt: 40,
|
||||
),
|
||||
onCameraMove: (position) {
|
||||
locationController.myLocation = position.target;
|
||||
|
||||
344
t dataBounds = []
Normal file
344
t dataBounds = []
Normal file
@@ -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
|
||||
[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
|
||||
Reference in New Issue
Block a user