Better location / gps maybe

This commit is contained in:
stopflock
2025-12-12 16:26:50 -06:00
parent 8493679526
commit 5312456a15
4 changed files with 273 additions and 44 deletions
+9 -1
View File
@@ -44,6 +44,7 @@ class MapView extends StatefulWidget {
this.onSuspectedLocationTap,
this.onSearchPressed,
this.onNodeLimitChanged,
this.onLocationStatusChanged,
});
final FollowMeMode followMeMode;
@@ -54,6 +55,7 @@ class MapView extends StatefulWidget {
final void Function(SuspectedLocation)? onSuspectedLocationTap;
final VoidCallback? onSearchPressed;
final void Function(bool isLimited)? onNodeLimitChanged;
final VoidCallback? onLocationStatusChanged;
@override
State<MapView> createState() => MapViewState();
@@ -121,7 +123,10 @@ class MapViewState extends State<MapView> {
_gpsController.initializeWithCallback(
followMeMode: widget.followMeMode,
controller: _controller,
onLocationUpdated: () => setState(() {}),
onLocationUpdated: () {
setState(() {});
widget.onLocationStatusChanged?.call(); // Notify parent about location status change
},
getCurrentFollowMeMode: () {
// Use mounted check to avoid calling context when widget is disposed
if (mounted) {
@@ -230,6 +235,9 @@ class MapViewState extends State<MapView> {
LatLng? getUserLocation() {
return _gpsController.currentLocation;
}
/// Whether we currently have a valid GPS location
bool get hasLocation => _gpsController.hasLocation;
/// Expose static methods from MapPositionManager for external access
static Future<void> clearStoredMapPosition() =>