fix(ui): Fix some ui bugs

This commit is contained in:
anhtunz
2025-02-28 09:47:29 +07:00
parent 50d96541e7
commit 314e32eaa9
11 changed files with 92 additions and 8 deletions

View File

@@ -54,6 +54,8 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
// LatLng myLocation = const LatLng(213761, 123123);
// Position? position;
// bool isAllowLocationPermission = false;
Timer? checkThemeTimer;
Timer? getMarker;
String themeMode = '';
@override
void initState() {
@@ -62,11 +64,17 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
_loadIcons();
getAllMarkers();
clusterManager = _initClusterManager();
const duration = Duration(seconds: 2);
checkThemeTimer = Timer.periodic(duration, (Timer t) => checkTheme());
const Duration markerDuration = Duration(seconds: 5);
getMarker = Timer.periodic(markerDuration, (Timer t) => getAllMarkers());
}
@override
void dispose() {
super.dispose();
checkThemeTimer?.cancel();
getMarker?.cancel();
_controller = Completer();
streamController.close();
}
@@ -142,7 +150,6 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
return rootBundle.loadString(path);
}
Future<void> _loadIcons() async {
List<Future<BitmapDescriptor>> iconFutures = imageAssets.map((asset) {
return BitmapDescriptor.asset(
@@ -245,7 +252,7 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
hasOtherState = true;
}
}
if (hasStateOne) {
return true; // flameIcon
} else if (hasOtherState) {