From 17cc8145daafa01a42159e7bb1fc46878fb6b4e8 Mon Sep 17 00:00:00 2001 From: Hamza Aleghwairyeen Date: Wed, 3 Apr 2024 02:29:42 +0300 Subject: [PATCH] 4/3/5 --- lib/controller/firebase/firbase_messge.dart | 2 +- .../functions/location_controller.dart | 18 +++++++++--------- .../home/captin/home_captain_controller.dart | 5 +++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart index 80e6ca7..30d854e 100644 --- a/lib/controller/firebase/firbase_messge.dart +++ b/lib/controller/firebase/firbase_messge.dart @@ -130,7 +130,7 @@ class FirebaseMessagesController extends GetxController { // var myPoints = jsonDecode(points) as List; driverToken = myList[14].toString(); // This is for location using and uploading status - Get.find().rideId = 'rideId'; + Get.find().changeRideId(); update(); // print('driverToken==============$driverToken'); Get.to(() => OrderRequestPage(), arguments: { diff --git a/lib/controller/functions/location_controller.dart b/lib/controller/functions/location_controller.dart index 5782eb3..4a0a706 100644 --- a/lib/controller/functions/location_controller.dart +++ b/lib/controller/functions/location_controller.dart @@ -55,15 +55,6 @@ class LocationController extends GetxController { print('total point is $totalPoints'); await getLocation(); - // Animate camera to user location (optional) - // if (Get.find().rideId == 'rideId') { - // Get.find() - // .mapController! - // .animateCamera(CameraUpdate.newLatLng(LatLng( - // Get.find().myLocation.latitude, - // Get.find().myLocation.longitude, - // ))); - // } // if (box.read(BoxName.driverID) != null) { await CRUD() @@ -80,6 +71,15 @@ class LocationController extends GetxController { : totalDistance.toStringAsFixed(1), 'status': box.read(BoxName.statusDriverLocation).toString() }); + // Animate camera to user location (optional) + if (Get.find().rideId == 'rideId') { + Get.find() + .mapController! + .animateCamera(CameraUpdate.newLatLng(LatLng( + Get.find().myLocation.latitude, + Get.find().myLocation.longitude, + ))); + } Get.find() .mapHomeCaptainController .animateCamera(CameraUpdate.newLatLng(LatLng( diff --git a/lib/controller/home/captin/home_captain_controller.dart b/lib/controller/home/captin/home_captain_controller.dart index e1f38e4..7b5459c 100644 --- a/lib/controller/home/captin/home_captain_controller.dart +++ b/lib/controller/home/captin/home_captain_controller.dart @@ -60,6 +60,11 @@ class HomeCaptainController extends GetxController { Get.to(() => WaletCaptain()); } + void changeRideId() { + rideId = 'rideId'; + update(); + } + String stringActiveDuration = ''; void onButtonSelected() { // totalPoints = Get.find().totalPoints;