Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[google_maps_flutter(_platform_interface)] Make the plugin friendlier to the web implementation. #2903

Merged
merged 11 commits into from
Aug 5, 2020

Conversation

ditman
Copy link
Member

@ditman ditman commented Jul 31, 2020

Description

This PR adds some small modifications to the core maps plugin and its platform interface, so the web version is doable.

It allows people using the experimental branch of google_maps_flutter_web to keep using it, without having to override many packages (and will also simplify the final merge of google_maps_flutter_web, so it only touches one package!)

This PR touches two packages, but both changes should be independent, and backwards compatible, so test should pass, and they can be merged and published in any order.

google_maps_flutter

  • Pass a constant creationMapId to platform.buildView, so web can return a cached widget DOM when flutter attempts to repaint there.
  • Modify some examples slightly so they're more web-friendly (remove dart:io imports, pass a size to the bitmap used as a custom Icon, so it gets rendered at the correct size in higher DPI screens)

google_maps_flutter_platform_interface

  • Pass icon width/height if present on fromAssetImage BitmapDescriptors (web only, because web can't determine the actual size of an asset at run-time as easily as the native side).

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • No, this is not a breaking change.

@ditman ditman requested a review from cyanglaz July 31, 2020 22:06
@ditman ditman changed the title Web friendlier maps [google_maps_flutter(_platform_interface)] Make the plugin friendlier to the web implementation. Jul 31, 2020
@ditman ditman requested a review from cyanglaz August 3, 2020 21:00
@ditman
Copy link
Member Author

ditman commented Aug 3, 2020

@cyanglaz and I discussed some changes in the chat, concerns about the creation map ID being a random number, and having a not very clear parameter name. I've updated the creation map ID to being an auto-incrementing int, and moving the creation parameter name to something more verbose/self explanatory.

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % tests and nits.

@ditman ditman merged commit b4b6e9e into flutter:master Aug 5, 2020
jarrodcolburn pushed a commit to jarrodcolburn/plugins that referenced this pull request Aug 20, 2020
…n. (flutter#2903)

This change tweaks slightly the core maps plugin and the platform interface package to make the web implementation possible.

The most important changes are two:

* The core plugin now passes a constant identifier to the buildView platform call, so the web version can cache effectively the contents of the platform view, so it doesn't repaint. This might go away once Scenelets for web come online.
* The platform interface now encodes the (optional) width and height of custom Icons for Markers, so the web can render High DPI assets at the correct size.

The rest are some examples to the 'example' app so it can be run on web.
@ditman ditman deleted the web-friendlier-maps branch August 25, 2020 22:04
jorgefspereira pushed a commit to jorgefspereira/plugins_flutter that referenced this pull request Oct 10, 2020
…n. (flutter#2903)

This change tweaks slightly the core maps plugin and the platform interface package to make the web implementation possible.

The most important changes are two:

* The core plugin now passes a constant identifier to the buildView platform call, so the web version can cache effectively the contents of the platform view, so it doesn't repaint. This might go away once Scenelets for web come online.
* The platform interface now encodes the (optional) width and height of custom Icons for Markers, so the web can render High DPI assets at the correct size.

The rest are some examples to the 'example' app so it can be run on web.
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
…n. (flutter#2903)

This change tweaks slightly the core maps plugin and the platform interface package to make the web implementation possible.

The most important changes are two:

* The core plugin now passes a constant identifier to the buildView platform call, so the web version can cache effectively the contents of the platform view, so it doesn't repaint. This might go away once Scenelets for web come online.
* The platform interface now encodes the (optional) width and height of custom Icons for Markers, so the web can render High DPI assets at the correct size.

The rest are some examples to the 'example' app so it can be run on web.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants