6/9/3
This commit is contained in:
@@ -97,8 +97,8 @@ class MapDriverController extends GetxController {
|
||||
String? mapAPIKEY;
|
||||
final zones = <Zone>[];
|
||||
String canelString = 'yet';
|
||||
late LatLng latLngpassengerLocation;
|
||||
late LatLng latLngPassengerDestination;
|
||||
LatLng latLngPassengerLocation = LatLng(0, 0);
|
||||
late LatLng latLngPassengerDestination = LatLng(0, 0);
|
||||
|
||||
void onMapCreated(GoogleMapController controller) async {
|
||||
myLocation = Get.find<LocationController>().location as LatLng;
|
||||
@@ -136,8 +136,8 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
|
||||
Future openGoogleMapFromDriverToPassenger() async {
|
||||
var endLat = latLngpassengerLocation.latitude;
|
||||
var endLng = latLngpassengerLocation.longitude;
|
||||
var endLat = latLngPassengerLocation.latitude;
|
||||
var endLng = latLngPassengerLocation.longitude;
|
||||
|
||||
var startLat = Get.find<LocationController>().myLocation.latitude;
|
||||
var startLng = Get.find<LocationController>().myLocation.longitude;
|
||||
@@ -365,8 +365,8 @@ class MapDriverController extends GetxController {
|
||||
|
||||
calculateDistanceBetweenDriverAndPassengerLocation() {
|
||||
double distance2 = Geolocator.distanceBetween(
|
||||
latLngpassengerLocation.latitude,
|
||||
latLngpassengerLocation.longitude,
|
||||
latLngPassengerLocation.latitude,
|
||||
latLngPassengerLocation.longitude,
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
);
|
||||
@@ -843,19 +843,11 @@ class MapDriverController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
late Duration durationToAdd;
|
||||
int hours = 0;
|
||||
int minutes = 0;
|
||||
late String carType;
|
||||
late String kazan;
|
||||
late String startNameLocation;
|
||||
late String endNameLocation;
|
||||
@override
|
||||
void onInit() async {
|
||||
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
||||
// Get the passenger location from the arguments.
|
||||
argumentLoading() async {
|
||||
passengerLocation = Get.arguments['passengerLocation'];
|
||||
print(passengerLocation);
|
||||
passengerDestination = Get.arguments['passengerDestination'];
|
||||
print(passengerDestination);
|
||||
duration = Get.arguments['Duration'];
|
||||
totalCost = Get.arguments['totalCost'];
|
||||
passengerId = Get.arguments['passengerId'];
|
||||
@@ -886,22 +878,29 @@ class MapDriverController extends GetxController {
|
||||
startNameLocation = Get.arguments['startNameLocation'];
|
||||
endNameLocation = Get.arguments['endNameLocation'];
|
||||
|
||||
var coords = passengerLocation.split(',');
|
||||
var coordDestination = passengerDestination.split(',');
|
||||
// var coords = passengerLocation.toString().split(',');
|
||||
// var coordDestination = passengerDestination.toString().split(',');
|
||||
|
||||
// Parse to double
|
||||
double latPassengerLocation = double.parse(coords[0]);
|
||||
double lngPassengerLocation = double.parse(coords[1]);
|
||||
double latPassengerDestination = double.parse(coordDestination[0]);
|
||||
double lngPassengerDestination = double.parse(coordDestination[1]);
|
||||
latLngpassengerLocation =
|
||||
double latPassengerLocation =
|
||||
double.parse(passengerLocation.toString().split(',')[0]);
|
||||
double lngPassengerLocation =
|
||||
double.parse(passengerLocation.toString().split(',')[1]);
|
||||
double latPassengerDestination =
|
||||
double.parse(passengerDestination.toString().split(',')[0]);
|
||||
double lngPassengerDestination =
|
||||
double.parse(passengerDestination.toString().split(',')[1]);
|
||||
latLngPassengerLocation =
|
||||
LatLng(latPassengerLocation, lngPassengerLocation);
|
||||
latLngPassengerDestination =
|
||||
LatLng(latPassengerDestination, lngPassengerDestination);
|
||||
String lat = Get.find<LocationController>().myLocation.latitude.toString();
|
||||
String lng = Get.find<LocationController>().myLocation.longitude.toString();
|
||||
String origin = '$lat,$lng';
|
||||
print('latLngpassengerLocation $latLngPassengerLocation');
|
||||
print('latLngPassengerDestination $latLngPassengerDestination');
|
||||
// Set the origin and destination coordinates for the Google Maps directions request.
|
||||
Future.delayed(const Duration(seconds: 1));
|
||||
getMap(origin, passengerLocation);
|
||||
isHaveSteps == 'haveSteps'
|
||||
? (
|
||||
@@ -911,6 +910,22 @@ class MapDriverController extends GetxController {
|
||||
step4 == '' ? await getMapDestination(step3, step4) : () {},
|
||||
)
|
||||
: await getMapDestination(passengerLocation, passengerDestination);
|
||||
update();
|
||||
}
|
||||
|
||||
late Duration durationToAdd;
|
||||
int hours = 0;
|
||||
int minutes = 0;
|
||||
late String carType;
|
||||
late String kazan;
|
||||
late String startNameLocation;
|
||||
late String endNameLocation;
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
||||
// Get the passenger location from the arguments.
|
||||
await argumentLoading();
|
||||
addCustomCarIcon();
|
||||
addCustomPassengerIcon();
|
||||
addCustomStartIcon();
|
||||
|
||||
Reference in New Issue
Block a user