fix: Adjust the zoom level (#24353)

Adjust the zoom level
pull/24376/head
Justin Forseth 2025-12-03 13:19:57 +07:00 committed by GitHub
parent 75dde0d076
commit 76b4adf276
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

@ -49,7 +49,7 @@ class MapLocationPickerPage extends HookConsumerWidget {
var currentLatLng = LatLng(currentLocation.latitude, currentLocation.longitude); var currentLatLng = LatLng(currentLocation.latitude, currentLocation.longitude);
selectedLatLng.value = currentLatLng; selectedLatLng.value = currentLatLng;
await controller.value?.animateCamera(CameraUpdate.newLatLng(currentLatLng)); await controller.value?.animateCamera(CameraUpdate.newLatLngZoom(currentLatLng, 12));
} }
return MapThemeOverride( return MapThemeOverride(
@ -66,7 +66,10 @@ class MapLocationPickerPage extends HookConsumerWidget {
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(40), bottomRight: Radius.circular(40)), borderRadius: BorderRadius.only(bottomLeft: Radius.circular(40), bottomRight: Radius.circular(40)),
), ),
child: MapLibreMap( child: MapLibreMap(
initialCameraPosition: CameraPosition(target: initialLatLng, zoom: 12), initialCameraPosition: CameraPosition(
target: initialLatLng,
zoom: (initialLatLng.latitude == 0 && initialLatLng.longitude == 0) ? 1 : 12,
),
styleString: style, styleString: style,
onMapCreated: (mapController) => controller.value = mapController, onMapCreated: (mapController) => controller.value = mapController,
onStyleLoadedCallback: onStyleLoaded, onStyleLoadedCallback: onStyleLoaded,