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: inactiveIcon:
IconConstants.instance.getMaterialIcon(Icons.group_outlined), 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? checkThemeTimer;
Timer? getMarker; Timer? getMarker;
String themeMode = ''; String themeMode = '';
bool _isDisposed = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -74,19 +75,21 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
@override @override
void dispose() { void dispose() {
_isDisposed = true;
checkThemeTimer?.cancel(); checkThemeTimer?.cancel();
getMarker?.cancel(); getMarker?.cancel();
_controller = Completer();
streamController.close(); streamController.close();
super.dispose(); super.dispose();
} }
void onMapCreated(GoogleMapController controller) { void onMapCreated(GoogleMapController controller) {
if (!_isDisposed && !streamController.isClosed) {
_controller.complete(controller); _controller.complete(controller);
streamController.add(controller); streamController.add(controller);
clusterManager.setMapId(controller.mapId); clusterManager.setMapId(controller.mapId);
checkTheme(); checkTheme();
} }
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -173,11 +176,11 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
return ClusterManager<Device>( return ClusterManager<Device>(
devices, devices,
_updateMarkers, _updateMarkers,
markerBuilder: _getmarkerBuilder(), markerBuilder: _getMarkerBuilder(),
); );
} }
Future<Marker> Function(Cluster<Device>) _getmarkerBuilder() => Future<Marker> Function(Cluster<Device>) _getMarkerBuilder() =>
(cluster) async { (cluster) async {
return Marker( return Marker(
markerId: MarkerId( markerId: MarkerId(