Update: 2026-07-22 23:20:32
This commit is contained in:
@@ -28,8 +28,22 @@ class NearbyDriversController extends GetxController {
|
||||
bool noCarString = false;
|
||||
final double minMovementThreshold = 2.0;
|
||||
final Map<String, Timer> _animationTimers = {};
|
||||
|
||||
final List<Map<String, dynamic>> fakeCarData = [];
|
||||
Timer? _autoRefreshTimer;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
detectPerfMode();
|
||||
_startPeriodicRefresh();
|
||||
}
|
||||
|
||||
void _startPeriodicRefresh() {
|
||||
_autoRefreshTimer?.cancel();
|
||||
_autoRefreshTimer = Timer.periodic(const Duration(seconds: 5), (_) {
|
||||
getCarsLocationByPassengerAndReloadMarker();
|
||||
});
|
||||
}
|
||||
|
||||
Future<bool> getCarsLocationByPassengerAndReloadMarker() async {
|
||||
carsLocationByPassenger = [];
|
||||
@@ -467,6 +481,7 @@ class NearbyDriversController extends GetxController {
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
_autoRefreshTimer?.cancel();
|
||||
_animationTimers.forEach((key, timer) => timer.cancel());
|
||||
_animationTimers.clear();
|
||||
super.onClose();
|
||||
|
||||
Reference in New Issue
Block a user