Skip to content

[google_maps_flutter] Expose an "onTilesLoaded" to notify when all tiles have been fully rendered. #99610

Open

Description

@FranRiadigos

Use case

The flutter plugin exposes an onMapCreated() function that states when the map is ready.
However, until all tiles are fully loaded it shows a grid with grey lines, and any effect or any interaction with the map seems useless until tiles are rendered.

These are the use cases I wish to accomplish:

  • Ensure all tiles are rendered before taking a snapshot.
    Running the method takeSnapshot() after onMapCreated() leads to an image with either, partial tiles rendered or none at all.
  • Zoom-in to a position once the map is first loaded.
    The zoom effect is kind of weird if done after onMapCreated() is fired, since it will zoom a grid of grey lines.

Proposal

Each platform already contains a functionality to determine when tiles are fully rendered:

  • Android - GoogleMap.OnMapLoadedCallback
  • iOS - GMSMapViewDelegate.mapViewDidFinishTileRendering
  • Web - Map.tilesloaded

However, AFAIK, there is no such functionality in the flutter plugin.

Activity

  1. maheshj01 commented on Mar 7, 2022

    @maheshj01
    Member

    Hi @FranRiadigos, Thanks for filing the issue. Google maps plugin currently doesn't have such a feature to notify when the tiles are loaded that looks like a valid proposal.

  2. changed the title [-][google_maps_flutter] Expose an "onTilesLoaded" to signal when all tiles have been fully rendered.[/-] [+][google_maps_flutter] Expose an "onTilesLoaded" to notify when all tiles have been fully rendered.[/+] on Mar 7, 2022
  3. added
    p: mapsGoogle Maps plugin
    c: proposalA detailed proposal for a change to Flutter
    c: new featureNothing broken; request for a new capability
    and removed
    in triagePresently being triaged by the triage team
    on Mar 7, 2022
  4. added
    P3Issues that are less important to the Flutter project
    on Mar 10, 2022
  5. FranRiadigos commented on May 14, 2022

    @FranRiadigos
    Author

    Hi,

    I recently got an issue on Crashlytics that might be related to my request.

    Please, let me know whether I should open a bug issue about it.

    When onMapCreated is fired, I call

    controller.animateCamera(CameraUpdate.newLatLngBounds(bounds, padding));

    Which produces the following error:

    com.google.maps.api.android.lib6.common.apiexception.c: Error using newLatLngBounds(LatLngBounds, int): Map size can't be 0. Most likely, layout has not yet occured for the map view. Either wait until layout has occurred or use newLatLngBounds(LatLngBounds, int, int, int) which allows you to specify the map's dimensions. at com.google.maps.api.android.lib6.common.m.i(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100400-0):0) ... 
    

    The GoogleMap widget is rendered using hybrid composition.

    AndroidGoogleMapsFlutter.useAndroidViewSurface = true;

    Thanks.

  6. maheshj01 commented on May 16, 2022

    @maheshj01
    Member

    @FranRiadigos, Please file that as a separate issue with all the requested details in the issue template and we will take a look at it.

  7. jhonatan-3a commented on Feb 22, 2023

    @jhonatan-3a
  8. oelburk commented on Mar 17, 2023

    @oelburk
  9. singh3abhi commented on Jun 25, 2023

    @singh3abhi
  10. Firdavs-coder commented on Feb 23, 2024

    @Firdavs-coder
  11. mariomurrent-softwaresolutions commented on Oct 18, 2024

    @mariomurrent-softwaresolutions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: 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