4/2/3
This commit is contained in:
@@ -35,7 +35,7 @@ class CRUD {
|
|||||||
// print(response.body);
|
// print(response.body);
|
||||||
var jsonData = jsonDecode(response.body);
|
var jsonData = jsonDecode(response.body);
|
||||||
if (jsonData['status'] == 'success') {
|
if (jsonData['status'] == 'success') {
|
||||||
// print(jsonData);
|
print(jsonData);
|
||||||
|
|
||||||
return response.body;
|
return response.body;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class MapDriverController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
|
|
||||||
// Set up a timer or interval to trigger the marker update every 3 seconds.
|
// Set up a timer or interval to trigger the marker update every 3 seconds.
|
||||||
timer = Timer.periodic(const Duration(seconds: 2), (_) {
|
timer = Timer.periodic(const Duration(seconds: 1), (_) {
|
||||||
updateMarker();
|
updateMarker();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ class MapDriverController extends GetxController {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void openGoogleMapFromDriverToPassenger() async {
|
Future openGoogleMapFromDriverToPassenger() async {
|
||||||
var endLat = latLngpassengerLocation.latitude;
|
var endLat = latLngpassengerLocation.latitude;
|
||||||
var endLng = latLngpassengerLocation.longitude;
|
var endLng = latLngpassengerLocation.longitude;
|
||||||
|
|
||||||
@@ -151,21 +151,6 @@ class MapDriverController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkIsDriverNearPassenger() async {
|
|
||||||
if (isDriverNearPassengerStart) {
|
|
||||||
Timer.periodic(const Duration(seconds: 3), (timer) {
|
|
||||||
String driverLat =
|
|
||||||
Get.find<LocationController>().myLocation.latitude.toString();
|
|
||||||
String driverLng =
|
|
||||||
Get.find<LocationController>().myLocation.longitude.toString();
|
|
||||||
|
|
||||||
// Replace "passengerLat" and "passengerLng" with the actual passenger's location
|
|
||||||
String passengerLat = passengerLocation; // Set the passenger's latitude
|
|
||||||
String passengerLng = ""; // Set the passenger's longitude
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearPolyline() {
|
void clearPolyline() {
|
||||||
polyLines = [];
|
polyLines = [];
|
||||||
polyLinesDestination = [];
|
polyLinesDestination = [];
|
||||||
@@ -181,33 +166,7 @@ class MapDriverController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void startTimerToShowPassengerInfoWindowFromDriver() async {
|
void startTimerToShowPassengerInfoWindowFromDriver() async {
|
||||||
// for (int i = 0;
|
|
||||||
// i <= progressTimerToShowPassengerInfoWindowFromDriver;
|
|
||||||
// i++) {
|
|
||||||
// await Future.delayed(const Duration(seconds: 1));
|
|
||||||
// if (canelString != 'Cancel') {
|
|
||||||
// cancelCheckRidefromPassenger();
|
|
||||||
// progress = i / progressTimerToShowPassengerInfoWindowFromDriver;
|
|
||||||
// remainingTimeToShowPassengerInfoWindowFromDriver =
|
|
||||||
// progressTimerToShowPassengerInfoWindowFromDriver - i;
|
|
||||||
|
|
||||||
// if (remainingTimeToShowPassengerInfoWindowFromDriver == 0) {
|
|
||||||
isPassengerInfoWindow = true;
|
isPassengerInfoWindow = true;
|
||||||
// print(isPassengerInfoWindow);
|
|
||||||
update();
|
|
||||||
startTimerToShowDriverToPassengerDuration();
|
|
||||||
// }
|
|
||||||
// print(isPassengerInfoWindow);
|
|
||||||
// print(remainingTimeToShowPassengerInfoWindowFromDriver);
|
|
||||||
// update();
|
|
||||||
// } else {
|
|
||||||
// Get.off(HomeCaptain());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
String stringRemainingTimeToPassenger = '';
|
|
||||||
void startTimerToShowDriverToPassengerDuration() async {
|
|
||||||
for (int i = 0; i <= int.parse(durationToPassenger); i++) {
|
for (int i = 0; i <= int.parse(durationToPassenger); i++) {
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
progressToPassenger = i / int.parse(durationToPassenger);
|
progressToPassenger = i / int.parse(durationToPassenger);
|
||||||
@@ -227,8 +186,12 @@ class MapDriverController extends GetxController {
|
|||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
// update();
|
||||||
|
// startTimerToShowDriverToPassengerDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String stringRemainingTimeToPassenger = '';
|
||||||
|
|
||||||
String stringRemainingTimeWaitingPassenger = '';
|
String stringRemainingTimeWaitingPassenger = '';
|
||||||
|
|
||||||
void startTimerToShowDriverWaitPassengerDuration() async {
|
void startTimerToShowDriverWaitPassengerDuration() async {
|
||||||
@@ -270,7 +233,7 @@ class MapDriverController extends GetxController {
|
|||||||
box.read(BoxName.name).toString(),
|
box.read(BoxName.name).toString(),
|
||||||
tokenPassenger);
|
tokenPassenger);
|
||||||
if (box.read(BoxName.googlaMapApp) == true) {
|
if (box.read(BoxName.googlaMapApp) == true) {
|
||||||
openGoogleMapFromDriverToPassenger();
|
await openGoogleMapFromDriverToPassenger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,16 +279,6 @@ class MapDriverController extends GetxController {
|
|||||||
|
|
||||||
Position? currentPosition;
|
Position? currentPosition;
|
||||||
|
|
||||||
calculateDistanceAndTimeSPEEDOMETER() async {
|
|
||||||
/* todo
|
|
||||||
save to sql
|
|
||||||
calculate distance and duration
|
|
||||||
get from sql
|
|
||||||
update ui for totla results
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
startRideFromDriver() async {
|
startRideFromDriver() async {
|
||||||
double _distance =
|
double _distance =
|
||||||
await calculateDistanceBetweenDriverAndPassengerLocation();
|
await calculateDistanceBetweenDriverAndPassengerLocation();
|
||||||
@@ -400,47 +353,31 @@ update ui for totla results
|
|||||||
|
|
||||||
double speedoMeter = 0;
|
double speedoMeter = 0;
|
||||||
void updateLocation() async {
|
void updateLocation() async {
|
||||||
StreamSubscription<Position>? locationSubscription;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LatLng? latestPosition; // Initialize outside the loop
|
|
||||||
for (var i = 0; i < remainingTimeTimerRideBegin; i++) {
|
for (var i = 0; i < remainingTimeTimerRideBegin; i++) {
|
||||||
await Future.delayed(const Duration(seconds: 2));
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
locationSubscription =
|
|
||||||
Geolocator.getPositionStream().listen((Position position) {
|
|
||||||
latestPosition = position as LatLng?; // Update latest position
|
|
||||||
|
|
||||||
// Calculate distance using the latest position
|
mapController!.animateCamera(
|
||||||
double distance = calculateDistanceInMeter(
|
CameraUpdate.newCameraPosition(
|
||||||
currentPosition as LatLng, latestPosition!);
|
CameraPosition(
|
||||||
speedoMeter = distance + speedoMeter;
|
target: myLocation,
|
||||||
print('distance is $distance');
|
zoom: 17, // Adjust zoom level as needed
|
||||||
print('SpedoMeter is $speedoMeter');
|
|
||||||
currentPosition = position;
|
|
||||||
// Update camera position on the map
|
|
||||||
mapController!.animateCamera(
|
|
||||||
CameraUpdate.newCameraPosition(
|
|
||||||
CameraPosition(
|
|
||||||
target: myLocation,
|
|
||||||
zoom: 17, // Adjust zoom level as needed
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
});
|
);
|
||||||
|
// });
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop listening after ride finishes
|
// Stop listening after ride finishes
|
||||||
if (!isRideBegin) {
|
if (!isRideBegin) {}
|
||||||
locationSubscription?.cancel();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugPrint('Error listening to GPS: $error');
|
debugPrint('Error listening to GPS: $error');
|
||||||
// Handle GPS errors gracefully
|
// Handle GPS errors gracefully
|
||||||
}
|
}
|
||||||
|
|
||||||
// Periodically call updateLocation again
|
// Periodically call updateLocation again
|
||||||
await Future.delayed(const Duration(seconds: 2));
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
updateLocation();
|
updateLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,59 +438,94 @@ update ui for totla results
|
|||||||
Get.find<LocationController>().myLocation.latitude,
|
Get.find<LocationController>().myLocation.latitude,
|
||||||
Get.find<LocationController>().myLocation.longitude,
|
Get.find<LocationController>().myLocation.longitude,
|
||||||
);
|
);
|
||||||
// if (distanceToDestination < 50) {
|
if (carType != 'Comfort' || carType != 'Free Ride') {
|
||||||
isRideFinished = true;
|
if (distanceToDestination < 50) {
|
||||||
isRideStarted = false;
|
isRideFinished = true;
|
||||||
isPriceWindow = false;
|
isRideStarted = false;
|
||||||
if (carType == 'Comfort' || carType == 'Free Ride') {
|
isPriceWindow = false;
|
||||||
|
|
||||||
|
box.write(BoxName.statusDriverLocation, 'off');
|
||||||
|
// changeRideToBeginToPassenger();
|
||||||
|
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||||
|
'id': rideId,
|
||||||
|
'rideTimeFinish': DateTime.now().toString(),
|
||||||
|
'status': 'Finished'
|
||||||
|
});
|
||||||
|
print('walletChecked is $walletChecked');
|
||||||
|
if (walletChecked == 'true') {
|
||||||
|
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||||
|
'passenger_id': passengerId,
|
||||||
|
'balance': ((-1) * double.parse(paymentAmount)).toString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
|
||||||
|
if (double.parse(passengerWalletBurc) < 0) {
|
||||||
|
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||||
|
'passenger_id': passengerId,
|
||||||
|
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
||||||
|
});
|
||||||
|
print(
|
||||||
|
'passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
|
||||||
|
}
|
||||||
|
Future.delayed(const Duration(milliseconds: 300));
|
||||||
|
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||||
|
'Driver Finish Trip',
|
||||||
|
'you will pay to Driver'.tr + ' $totalCost \$'.tr,
|
||||||
|
tokenPassenger,
|
||||||
|
[
|
||||||
|
box.read(BoxName.driverID),
|
||||||
|
rideId,
|
||||||
|
box.read(BoxName.tokenDriver),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
Get.defaultDialog(
|
||||||
|
title: 'You don\'t arrive destenation yet .'.tr,
|
||||||
|
middleText: '',
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'Ok'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
totalCost = price.toStringAsFixed(2);
|
totalCost = price.toStringAsFixed(2);
|
||||||
paymentAmount = totalCost;
|
paymentAmount = totalCost;
|
||||||
// update();
|
box.write(BoxName.statusDriverLocation, 'off');
|
||||||
}
|
// changeRideToBeginToPassenger();
|
||||||
box.write(BoxName.statusDriverLocation, 'off');
|
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||||
// changeRideToBeginToPassenger();
|
'id': rideId,
|
||||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
'rideTimeFinish': DateTime.now().toString(),
|
||||||
'id': rideId,
|
'status': 'Finished'
|
||||||
'rideTimeFinish': DateTime.now().toString(),
|
|
||||||
'status': 'Finished'
|
|
||||||
});
|
|
||||||
print('walletChecked is $walletChecked');
|
|
||||||
if (walletChecked == 'true') {
|
|
||||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
|
||||||
'passenger_id': passengerId,
|
|
||||||
'balance': ((-1) * double.parse(paymentAmount)).toString()
|
|
||||||
});
|
});
|
||||||
|
print('walletChecked is $walletChecked');
|
||||||
|
if (walletChecked == 'true') {
|
||||||
|
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||||
|
'passenger_id': passengerId,
|
||||||
|
'balance': ((-1) * double.parse(paymentAmount)).toString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
|
||||||
|
if (double.parse(passengerWalletBurc) < 0) {
|
||||||
|
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||||
|
'passenger_id': passengerId,
|
||||||
|
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
||||||
|
});
|
||||||
|
print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
|
||||||
|
}
|
||||||
|
Future.delayed(const Duration(milliseconds: 300));
|
||||||
|
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||||
|
'Driver Finish Trip',
|
||||||
|
'you will pay to Driver'.tr + ' $totalCost \$'.tr,
|
||||||
|
tokenPassenger,
|
||||||
|
[
|
||||||
|
box.read(BoxName.driverID),
|
||||||
|
rideId,
|
||||||
|
box.read(BoxName.tokenDriver),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
|
|
||||||
if (double.parse(passengerWalletBurc) < 0) {
|
|
||||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
|
||||||
'passenger_id': passengerId,
|
|
||||||
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
|
||||||
});
|
|
||||||
print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
|
|
||||||
}
|
|
||||||
Future.delayed(const Duration(milliseconds: 300));
|
|
||||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
|
||||||
'Driver Finish Trip',
|
|
||||||
'you will pay to Driver'.tr + ' $totalCost \$'.tr,
|
|
||||||
tokenPassenger,
|
|
||||||
[
|
|
||||||
box.read(BoxName.driverID),
|
|
||||||
rideId,
|
|
||||||
box.read(BoxName.tokenDriver),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// Get.defaultDialog(
|
|
||||||
// title: 'You don\'t arrive destenation yet .'.tr,
|
|
||||||
// middleText: '',
|
|
||||||
// confirm: MyElevatedButton(
|
|
||||||
// title: 'Ok'.tr,
|
|
||||||
// onPressed: () {
|
|
||||||
// Get.back();
|
|
||||||
// }));
|
|
||||||
// }
|
|
||||||
// add wallet from passenger from driver
|
// add wallet from passenger from driver
|
||||||
Get.to(() => RatePassenger(), arguments: {
|
Get.to(() => RatePassenger(), arguments: {
|
||||||
'passengerId': passengerId,
|
'passengerId': passengerId,
|
||||||
@@ -644,41 +616,15 @@ update ui for totla results
|
|||||||
double recentAngelToMarker = 0;
|
double recentAngelToMarker = 0;
|
||||||
double speed = 0;
|
double speed = 0;
|
||||||
void updateMarker() async {
|
void updateMarker() async {
|
||||||
|
|
||||||
// Remove the existing marker with the ID `MyLocation`.
|
// Remove the existing marker with the ID `MyLocation`.
|
||||||
markers.remove(MarkerId('MyLocation'));
|
markers.remove( MarkerId('MyLocation'));
|
||||||
|
|
||||||
// Add a new marker with the ID `MyLocation` at the current location of the user.
|
// Add a new marker with the ID `MyLocation` at the current location of the user.
|
||||||
LocationController locationController = Get.find<LocationController>();
|
LocationController locationController = Get.find<LocationController>();
|
||||||
myLocation = locationController.myLocation;
|
myLocation = locationController.myLocation;
|
||||||
final previousLocationOfDrivers = await sql.getCustomQuery('''SELECT
|
|
||||||
*
|
|
||||||
FROM
|
|
||||||
${TableName.rideLocation}
|
|
||||||
WHERE
|
|
||||||
order_id = $rideId
|
|
||||||
ORDER BY
|
|
||||||
created_at DESC
|
|
||||||
LIMIT
|
|
||||||
1''');
|
|
||||||
print(previousLocationOfDrivers);
|
|
||||||
//get from sql
|
|
||||||
if (previousLocationOfDrivers.isNotEmpty) {
|
|
||||||
var lat = double.parse(previousLocationOfDrivers[0]['lat']);
|
|
||||||
var lng = double.parse(previousLocationOfDrivers[0]['lng']);
|
|
||||||
LatLng prev = LatLng(lat, lng);
|
|
||||||
|
|
||||||
// recentDistanceToDash =
|
|
||||||
// calculateDistanceBetweenLocations(prev, myLocation);
|
|
||||||
print('recentAngelToMarker $recentAngelToMarker');
|
|
||||||
print('recentDistanceToDash $recentDistanceToDash');
|
|
||||||
}
|
|
||||||
sql.insertData({
|
|
||||||
'order_id': rideId,
|
|
||||||
'created_at': DateTime.now().microsecondsSinceEpoch.toString(),
|
|
||||||
'lat': myLocation.latitude.toString(),
|
|
||||||
'lng': myLocation.longitude.toString(),
|
|
||||||
}, TableName.rideLocation);
|
|
||||||
|
|
||||||
markers.add(
|
markers.add(
|
||||||
Marker(
|
Marker(
|
||||||
markerId: MarkerId('MyLocation'.tr),
|
markerId: MarkerId('MyLocation'.tr),
|
||||||
@@ -947,6 +893,7 @@ LIMIT
|
|||||||
addCustomStartIcon();
|
addCustomStartIcon();
|
||||||
addCustomEndIcon();
|
addCustomEndIcon();
|
||||||
// updateMarker();
|
// updateMarker();
|
||||||
|
updateLocation();
|
||||||
startTimerToShowPassengerInfoWindowFromDriver();
|
startTimerToShowPassengerInfoWindowFromDriver();
|
||||||
durationToAdd = Duration(seconds: int.parse(duration));
|
durationToAdd = Duration(seconds: int.parse(duration));
|
||||||
hours = durationToAdd.inHours;
|
hours = durationToAdd.inHours;
|
||||||
|
|||||||
@@ -737,7 +737,7 @@ class MapPassengerController extends GetxController {
|
|||||||
late String make;
|
late String make;
|
||||||
late String licensePlate;
|
late String licensePlate;
|
||||||
confirmRideForFirstDriver() async {
|
confirmRideForFirstDriver() async {
|
||||||
await getCarsLocationByPassenger();
|
await getCarsLocationByPassengerAndReloadMarker();
|
||||||
await getNearestDriverByPassengerLocationAPIGOOGLE();
|
await getNearestDriverByPassengerLocationAPIGOOGLE();
|
||||||
|
|
||||||
if (dataCarsLocationByPassenger != 'failure') {
|
if (dataCarsLocationByPassenger != 'failure') {
|
||||||
@@ -1064,7 +1064,7 @@ class MapPassengerController extends GetxController {
|
|||||||
late LatLng currentDriverLocation;
|
late LatLng currentDriverLocation;
|
||||||
late double headingList;
|
late double headingList;
|
||||||
|
|
||||||
Future getCarsLocationByPassenger() async {
|
Future getCarsLocationByPassengerAndReloadMarker() async {
|
||||||
// if (rideConfirm == false) {
|
// if (rideConfirm == false) {
|
||||||
carsLocationByPassenger = [];
|
carsLocationByPassenger = [];
|
||||||
LatLngBounds bounds = calculateBounds(
|
LatLngBounds bounds = calculateBounds(
|
||||||
@@ -1208,8 +1208,8 @@ class MapPassengerController extends GetxController {
|
|||||||
['latitude']),
|
['latitude']),
|
||||||
double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
|
||||||
['longitude']));
|
['longitude']));
|
||||||
print('driver position $driverPosition')
|
print('driver position $driverPosition');
|
||||||
; final driverAcceptedMarker = Marker(
|
final driverAcceptedMarker = Marker(
|
||||||
markerId: const MarkerId('driverToPassengers'),
|
markerId: const MarkerId('driverToPassengers'),
|
||||||
position: driverPosition,
|
position: driverPosition,
|
||||||
rotation: double.parse(
|
rotation: double.parse(
|
||||||
@@ -1667,7 +1667,7 @@ class MapPassengerController extends GetxController {
|
|||||||
//print('Reloading markers ($reloadCount)');
|
//print('Reloading markers ($reloadCount)');
|
||||||
if (!rideConfirm) {
|
if (!rideConfirm) {
|
||||||
reloadMarkers();
|
reloadMarkers();
|
||||||
}else{
|
} else {
|
||||||
runWhenRideIsBegin();
|
runWhenRideIsBegin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1680,49 +1680,8 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
reloadMarkers() async {
|
reloadMarkers() async {
|
||||||
if (statusRide == 'wait') {
|
if (statusRide == 'wait') {
|
||||||
await getCarsLocationByPassenger();
|
await getCarsLocationByPassengerAndReloadMarker();
|
||||||
await getNearestDriverByPassengerLocation();
|
await getNearestDriverByPassengerLocation();
|
||||||
// markers.clear();
|
|
||||||
|
|
||||||
// update();
|
|
||||||
// if (rideConfirm) {
|
|
||||||
|
|
||||||
// }
|
|
||||||
// Add new markers
|
|
||||||
// Example: Add a marker for each item in a list
|
|
||||||
for (var item in carsLocationByPassenger) {
|
|
||||||
// for (var i = 0; i <dataCarsLocationByPassenger['message'].length; i++) {
|
|
||||||
// if (previousLocationOfDrivers != null) {
|
|
||||||
// angleDegrees = calculateAngleBetweenLocations(
|
|
||||||
// previousLocationOfDrivers, currentLocationOfDrivers);
|
|
||||||
// // Use the calculated angle for rotation, if needed
|
|
||||||
// print('angleDegrees $angleDegrees');
|
|
||||||
// print('previousLocationOfDrivers $previousLocationOfDrivers');
|
|
||||||
// print('currentLocationOfDrivers $currentLocationOfDrivers');
|
|
||||||
// }
|
|
||||||
final marker = Marker(
|
|
||||||
position: LatLng(
|
|
||||||
// double.parse(
|
|
||||||
// datadriverCarsLocationToPassengerAfterApplied['message'][i]
|
|
||||||
// ['latitude']),
|
|
||||||
// double.parse(
|
|
||||||
// datadriverCarsLocationToPassengerAfterApplied['message'][i]
|
|
||||||
// ['longitude'])),
|
|
||||||
item.latitude,
|
|
||||||
item.longitude,
|
|
||||||
),
|
|
||||||
icon: carIcon,
|
|
||||||
markerId: MarkerId(item.toString()),
|
|
||||||
rotation: item.heading,
|
|
||||||
// Other properties for the marker, such as icon, info window, etc.
|
|
||||||
);
|
|
||||||
markers.add(marker);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the map with the new markers
|
|
||||||
// mapController?.animateCamera(CameraUpdate.newLatLng(
|
|
||||||
// LatLng(passengerLocation.latitude, passengerLocation.longitude)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1902,7 +1861,7 @@ class MapPassengerController extends GetxController {
|
|||||||
late String endNameAddress;
|
late String endNameAddress;
|
||||||
getMap(String origin, destination) async {
|
getMap(String origin, destination) async {
|
||||||
remainingTime = 25; //to make cancel every call
|
remainingTime = 25; //to make cancel every call
|
||||||
await getCarsLocationByPassenger();
|
await getCarsLocationByPassengerAndReloadMarker();
|
||||||
// //print(carsLocationByPassenger);
|
// //print(carsLocationByPassenger);
|
||||||
var coordDestination = destination.split(',');
|
var coordDestination = destination.split(',');
|
||||||
double latPassengerDestination = double.parse(coordDestination[0]);
|
double latPassengerDestination = double.parse(coordDestination[0]);
|
||||||
@@ -2051,7 +2010,7 @@ class MapPassengerController extends GetxController {
|
|||||||
getMapPoints(String originSteps, String destinationSteps, int index) async {
|
getMapPoints(String originSteps, String destinationSteps, int index) async {
|
||||||
isWayPointStopsSheetUtilGetMap = false;
|
isWayPointStopsSheetUtilGetMap = false;
|
||||||
// haveSteps = true;
|
// haveSteps = true;
|
||||||
await getCarsLocationByPassenger();
|
await getCarsLocationByPassengerAndReloadMarker();
|
||||||
// isLoading = true;
|
// isLoading = true;
|
||||||
update();
|
update();
|
||||||
var url =
|
var url =
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class PassengerInfoWindow extends StatelessWidget {
|
|||||||
decoration:
|
decoration:
|
||||||
AppStyle.boxDecoration,
|
AppStyle.boxDecoration,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () {
|
onPressed: () async{await
|
||||||
controller
|
controller
|
||||||
.openGoogleMapFromDriverToPassenger();
|
.openGoogleMapFromDriverToPassenger();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user