2/25/2
This commit is contained in:
@@ -290,6 +290,7 @@ class MapDriverController extends GetxController {
|
||||
return d['message'][0]['count'];
|
||||
}
|
||||
|
||||
Position? currentPosition;
|
||||
void startRideFromDriver() async {
|
||||
changeRideToBeginToPassenger();
|
||||
isPassengerInfoWindow = false;
|
||||
@@ -325,7 +326,37 @@ class MapDriverController extends GetxController {
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
});
|
||||
var d = jsonDecode(res);
|
||||
mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 18));
|
||||
// mapController!.animateCamera(
|
||||
// CameraUpdate.newLatLngZoom(
|
||||
// myLocation,
|
||||
// 12,
|
||||
// ),
|
||||
// );
|
||||
|
||||
StreamSubscription<Position>? locationSubscription;
|
||||
|
||||
try {
|
||||
locationSubscription =
|
||||
Geolocator.getPositionStream().listen((Position position) {
|
||||
currentPosition = position;
|
||||
// Update camera position on the map
|
||||
mapController!.animateCamera(
|
||||
CameraUpdate.newCameraPosition(
|
||||
CameraPosition(
|
||||
target: LatLng(position.latitude, position.longitude),
|
||||
zoom: 7,
|
||||
),
|
||||
),
|
||||
);
|
||||
}); // Stop listening to GPS updates when the ride is finished
|
||||
if (!isRideBegin) {
|
||||
locationSubscription?.cancel();
|
||||
}
|
||||
} catch (error) {
|
||||
debugPrint('Error listening to GPS: $error');
|
||||
// Handle GPS errors gracefully, e.g., show a user-friendly message
|
||||
}
|
||||
|
||||
update();
|
||||
print('...................');
|
||||
print(d);
|
||||
|
||||
Reference in New Issue
Block a user