This commit is contained in:
anhtunz
2025-06-09 15:43:50 +07:00
parent 3a8fa3633c
commit 22fef0e0a8
2 changed files with 10 additions and 16 deletions

View File

@@ -194,15 +194,6 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
inactiveIcon:
IconConstants.instance.getMaterialIcon(Icons.group_outlined),
),
// PersistentBottomNavBarItem(
// icon: IconConstants.instance
// .getMaterialIcon(Icons.notifications_outlined),
// title: appLocalization(context).notification,
// activeColorPrimary: Colors.blue,
// inactiveColorPrimary: Colors.grey,
// inactiveIcon: IconConstants.instance
// .getMaterialIcon(Icons.notifications_outlined),
// ),
];
}

View File

@@ -59,6 +59,7 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
Timer? checkThemeTimer;
Timer? getMarker;
String themeMode = '';
bool _isDisposed = false;
@override
void initState() {
super.initState();
@@ -74,18 +75,20 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
@override
void dispose() {
_isDisposed = true;
checkThemeTimer?.cancel();
getMarker?.cancel();
_controller = Completer();
streamController.close();
super.dispose();
}
void onMapCreated(GoogleMapController controller) {
_controller.complete(controller);
streamController.add(controller);
clusterManager.setMapId(controller.mapId);
checkTheme();
if (!_isDisposed && !streamController.isClosed) {
_controller.complete(controller);
streamController.add(controller);
clusterManager.setMapId(controller.mapId);
checkTheme();
}
}
@override
@@ -173,11 +176,11 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
return ClusterManager<Device>(
devices,
_updateMarkers,
markerBuilder: _getmarkerBuilder(),
markerBuilder: _getMarkerBuilder(),
);
}
Future<Marker> Function(Cluster<Device>) _getmarkerBuilder() =>
Future<Marker> Function(Cluster<Device>) _getMarkerBuilder() =>
(cluster) async {
return Marker(
markerId: MarkerId(