4/2/8
This commit is contained in:
@@ -56,6 +56,23 @@ class LocationController extends GetxController {
|
||||
print('total point is $totalPoints');
|
||||
|
||||
await getLocation();
|
||||
// Animate camera to user location (optional)
|
||||
if (Get.find<HomeCaptainController>().rideId == 'rideId') {
|
||||
Get.find<MapDriverController>()
|
||||
.mapController!
|
||||
.animateCamera(CameraUpdate.newLatLng(LatLng(
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
)));
|
||||
} else {
|
||||
Get.find<HomeCaptainController>()
|
||||
.mapHomeCaptainController
|
||||
.animateCamera(CameraUpdate.newLatLng(LatLng(
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
)));
|
||||
}
|
||||
|
||||
// if (box.read(BoxName.driverID) != null) {
|
||||
await CRUD()
|
||||
.post(link: AppLink.addCarsLocationByPassenger, payload: {
|
||||
@@ -71,21 +88,21 @@ class LocationController extends GetxController {
|
||||
: totalDistance.toStringAsFixed(1),
|
||||
'status': box.read(BoxName.statusDriverLocation).toString()
|
||||
});
|
||||
if (Get.find<HomeCaptainController>().rideId == '0') {
|
||||
await sql.insertData({
|
||||
'driver_id': box.read(BoxName.driverID),
|
||||
'latitude': myLocation.latitude.toString(),
|
||||
'longitude': myLocation.longitude.toString(),
|
||||
'created_at': DateTime.now().toString(),
|
||||
}, TableName.carLocations);
|
||||
} else {
|
||||
await sql.insertData({
|
||||
'order_id': Get.find<MapDriverController>().rideId,
|
||||
'created_at': DateTime.now().toString(),
|
||||
'lat': myLocation.latitude.toString(),
|
||||
'lng': myLocation.longitude.toString(),
|
||||
}, TableName.rideLocation);
|
||||
}
|
||||
// if (Get.find<HomeCaptainController>().rideId == '0') {
|
||||
// await sql.insertData({
|
||||
// 'driver_id': box.read(BoxName.driverID),
|
||||
// 'latitude': myLocation.latitude.toString(),
|
||||
// 'longitude': myLocation.longitude.toString(),
|
||||
// 'created_at': DateTime.now().toString(),
|
||||
// }, TableName.carLocations);
|
||||
// } else {
|
||||
// await sql.insertData({
|
||||
// 'order_id': Get.find<MapDriverController>().rideId,
|
||||
// 'created_at': DateTime.now().toString(),
|
||||
// 'lat': myLocation.latitude.toString(),
|
||||
// 'lng': myLocation.longitude.toString(),
|
||||
// }, TableName.rideLocation);
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user