diff --git a/lib/src/map/map.dart b/lib/src/map/map.dart index aa9e6e78d..5515a7a27 100644 --- a/lib/src/map/map.dart +++ b/lib/src/map/map.dart @@ -377,10 +377,20 @@ class MapState { } // Try and fit the corners of the map inside the visible area. - // If it's still outside (so response is null), don't perform a move. + // If it's still outside (so response is null) and the map as already been + // drawn do nothing, otherwise on first pass adjust zoom to either fit + // the options.maxZoom or draw at max zoom with allowing map to draw + // ouside boundaries to avoid center never being set. In this state the map + // is not movable except to rotate. if (options.maxBounds != null) { - final adjustedCenter = + LatLng? adjustedCenter = adjustCenterIfOutsideMaxBounds(center, zoom, options.maxBounds!); + if (adjustedCenter == null && _lastCenter == null) { + final centerZoom = getBoundsCenterZoom(options.maxBounds!, + FitBoundsOptions(inside: true, maxZoom: options.maxZoom ?? 17)); + adjustedCenter = centerZoom.center; + zoom = centerZoom.zoom; + } if (adjustedCenter == null) { return false; } else {