From 67bbac163632c313e110d93897f7899475f76d6e Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 5 Dec 2022 19:04:12 +0000 Subject: [PATCH 1/2] fix for broken bounds/fitBounds when it has a size of 0 (web ok, mobile not as faster) --- lib/src/map/flutter_map_state.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/map/flutter_map_state.dart b/lib/src/map/flutter_map_state.dart index 09525a16c..4cba0caa4 100644 --- a/lib/src/map/flutter_map_state.dart +++ b/lib/src/map/flutter_map_state.dart @@ -162,7 +162,7 @@ class FlutterMapState extends MapGestureMixin //Update on layout change setSize(constraints.maxWidth, constraints.maxHeight); - if (options.bounds != null && !_hasFitInitialBounds) { + if (options.bounds != null && !_hasFitInitialBounds && constraints.maxWidth != 0.0) { final target = getBoundsCenterZoom(options.bounds!, options.boundsOptions); _zoom = target.zoom; _center = target.center; From 711a4c583c808b824579de922bab9540c9679a53 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 5 Dec 2022 19:08:03 +0000 Subject: [PATCH 2/2] dart formatting --- lib/src/map/flutter_map_state.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/src/map/flutter_map_state.dart b/lib/src/map/flutter_map_state.dart index 4cba0caa4..ef1e73135 100644 --- a/lib/src/map/flutter_map_state.dart +++ b/lib/src/map/flutter_map_state.dart @@ -156,14 +156,16 @@ class FlutterMapState extends MapGestureMixin }, ); - return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { //Update on layout change setSize(constraints.maxWidth, constraints.maxHeight); - if (options.bounds != null && !_hasFitInitialBounds && constraints.maxWidth != 0.0) { - final target = getBoundsCenterZoom(options.bounds!, options.boundsOptions); + if (options.bounds != null && + !_hasFitInitialBounds && + constraints.maxWidth != 0.0) { + final target = + getBoundsCenterZoom(options.bounds!, options.boundsOptions); _zoom = target.zoom; _center = target.center; _hasFitInitialBounds = true;