Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bounds/fitBounds not working on first display. #1413

Merged
merged 2 commits into from
Dec 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/src/map/flutter_map_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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;
Expand Down