diff --git a/sport-log-client/lib/helpers/map_controller.dart b/sport-log-client/lib/helpers/map_controller.dart index ac4c135c..ca2dfdea 100644 --- a/sport-log-client/lib/helpers/map_controller.dart +++ b/sport-log-client/lib/helpers/map_controller.dart @@ -218,13 +218,13 @@ class MapController { geometry: latLng.toPoint(), circleRadius: _markerRadius, circleColor: color, - circleOpacity: 0.5, + circleOpacity: 0.8, ), CircleAnnotationOptions( geometry: latLng.toPoint(), circleRadius: isGps ? _gpsMarkerRadius : _noGpsMarkerRadius, circleColor: color, - circleOpacity: 0.3, + circleOpacity: 0.4, ), ])) ?.cast(); diff --git a/sport-log-client/lib/widgets/map_widgets/current_location_button.dart b/sport-log-client/lib/widgets/map_widgets/current_location_button.dart index e5ddcfa6..b40455fd 100644 --- a/sport-log-client/lib/widgets/map_widgets/current_location_button.dart +++ b/sport-log-client/lib/widgets/map_widgets/current_location_button.dart @@ -18,7 +18,7 @@ class CurrentLocationButton extends StatelessWidget { final MapController mapController; final LocationUtils locationUtils; - final bool centerLocation; + final Pointer centerLocation; final NullablePointer> currentLocationMarker; Future _toggleCurrentLocation() async { @@ -38,7 +38,7 @@ class CurrentLocationButton extends StatelessWidget { } Future _onLocationUpdate(GpsPosition location) async { - if (centerLocation) { + if (centerLocation.object) { await mapController.animateCenter(location.latLng); } await mapController.updateCurrentLocationMarker( diff --git a/sport-log-client/lib/widgets/map_widgets/mapbox_map_wrapper.dart b/sport-log-client/lib/widgets/map_widgets/mapbox_map_wrapper.dart index fa80f5a3..8c928e95 100644 --- a/sport-log-client/lib/widgets/map_widgets/mapbox_map_wrapper.dart +++ b/sport-log-client/lib/widgets/map_widgets/mapbox_map_wrapper.dart @@ -81,7 +81,7 @@ class _MapboxMapWrapperState extends State { MapController? _mapController; final LocationUtils _locationUtils = LocationUtils(inBackground: false); - bool _centerLocation = true; + final Pointer _centerLocation = Pointer(true); Route? _selectedRoute; final NullablePointer> _currentLocationMarker = @@ -201,10 +201,13 @@ class _MapboxMapWrapperState extends State { ], if (widget.showCenterLocationButton) ...[ ToggleCenterLocationButton( - centerLocation: _centerLocation, + centerLocation: _centerLocation.object, onToggle: () { - setState(() => _centerLocation = !_centerLocation); - widget.onCenterLocationToggle?.call(_centerLocation); + setState( + () => _centerLocation.object = !_centerLocation.object, + ); + widget.onCenterLocationToggle + ?.call(_centerLocation.object); }, ), Defaults.sizedBox.vertical.normal,