Skip to content

[google_maps_flutter] Cannot set map bounds (cameraTargetBounds). #25298

@kaushiksamanta

Description

@kaushiksamanta

Setting the map by providing bounds does not work. It is always zoomed out.
It should automatically adjust zoom according to the map bounds.
Currently, in the code, the bounds are set to new york.
map

Code

@override
  Widget build(BuildContext context) {
    return GoogleMap(
        onMapCreated: _onMapCreated,
        options: GoogleMapOptions(
          cameraTargetBounds: new CameraTargetBounds(new LatLngBounds(
              northeast: LatLng(40.73215972821489, -73.980936957489),
              southwest: LatLng(40.7152797683329, -74.01919598687743)
            )
          ),
          zoomGesturesEnabled: true,
          mapType: MapType.normal,
          trackCameraPosition: true,
        ));
  }

Flutter Doctor

[✓] Flutter (Channel beta, v1.0.0, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] Android Studio (version 3.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2018.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.29.1)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.found in release: 2.0Found to occur in 2.0found in release: 2.2Found to occur in 2.2has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: mapsGoogle Maps pluginpackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions