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