-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[google_maps_flutter_web] Omit styles when cloudMapId is set #9869
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
base: main
Are you sure you want to change the base?
[google_maps_flutter_web] Omit styles when cloudMapId is set #9869
Conversation
When `cloudMapId` is set, styles must be omitted to avoid conflicts. Now we set `MapOptions.mapId` and leave `styles` null in that case. Tests: add `cloud_map_styles_test` (web integration) to verify: - cloudMapId present ⇒ styles omitted, mapId set - no cloudMapId ⇒ styles applied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses an issue where using cloudMapId
for cloud-based styling on the web would fail if the style
property was also present. The change correctly omits setting styles on the map when a cloudMapId
is provided. New integration tests are added to verify that styles are omitted when cloudMapId
is present, and applied when it's not. The implementation is correct, but my feedback points out the use of a deprecated cloudMapId
property, suggesting to use the current mapId
property instead. This is to adhere to the project's style guide, which recommends following Effective Dart style, including avoiding deprecated members.
...gle_maps_flutter/google_maps_flutter_web/example/integration_test/cloud_map_styles_test.dart
Outdated
Show resolved
Hide resolved
...gle_maps_flutter/google_maps_flutter_web/example/integration_test/cloud_map_styles_test.dart
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart
Show resolved
Hide resolved
Linux analyze_downgraded stableFailing after 6m — Linux analyze_downgraded stable error - lib/src/convert.dart:103:21 - The getter 'mapId' isn't defined for the type 'MapConfiguration'. Try importing the library that defines 'mapId', correcting the name to the name of an existing getter, or defining a getter or field named 'mapId'. - undefined_getter 1 issue found.
When `cloudMapId` is set, styles must be omitted to avoid conflicts. Now we set `MapOptions.mapId` and leave `styles` null in that case. Tests: add `cloud_map_styles_test` (web integration) to verify: - cloudMapId present ⇒ styles omitted, mapId set - no cloudMapId ⇒ styles applied
Linux analyze_downgraded stableFailing after 6m — Linux analyze_downgraded stable error - lib/src/convert.dart:103:21 - The getter 'mapId' isn't defined for the type 'MapConfiguration'. Try importing the library that defines 'mapId', correcting the name to the name of an existing getter, or defining a getter or field named 'mapId'. - undefined_getter 1 issue found.
e65b28e
to
08c8c84
Compare
…into fix-maps-web-style-conflict-v2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
c98003a
to
b9b4b66
Compare
@@ -115,15 +115,17 @@ gmaps.MapOptions _configurationAndStyleToGmapsOptions( | |||
options.rotateControl = configuration.fortyFiveDegreeImageryEnabled; | |||
} | |||
|
|||
// If using cloud map, do not set options.styles | |||
if (configuration.cloudMapId == null) { | |||
options.styles = styles; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this code moved?
@@ -1,3 +1,7 @@ | |||
## 0.5.15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a bugfix of a pre-1.0 package, it should be 0.5.14+1
When
cloudMapId
is set, styles must be omitted to avoid conflicts. Now we setMapOptions.mapId
and leavestyles
null in that case.Tests: add
cloud_map_styles_test
(web integration) to verify:Fixes flutter/flutter#161951
[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assist
bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3