-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[google_maps_flutter_web] Add cameraControl enable/disable & position on web #9921
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
[google_maps_flutter_web] Add cameraControl enable/disable & position on web #9921
Conversation
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 adds support for enabling, disabling, and positioning the camera control button on the web. The implementation appears correct, and the core logic in convert.dart properly translates the new MapConfiguration options. I have provided one comment on the integration tests to address duplicated test names and code, suggesting a refactoring to improve clarity and maintainability.
...ps_flutter/google_maps_flutter_web/example/integration_test/google_maps_controller_test.dart
Show resolved
Hide resolved
| return gmaps.ControlPosition.TOP_LEFT; | ||
| case WebCameraControlPosition.topRight: | ||
| return gmaps.ControlPosition.TOP_RIGHT; | ||
| } |
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.
There needs to be a return outside of this, to handle the case of an enum value being added, since it comes from a different package. See
packages/packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart
Lines 138 to 144 in 4d26fb7
| // The enum comes from a different package, which could get a new value at | |
| // any time, so provide a fallback that ensures this won't break when used | |
| // with a version that contains new values. This is deliberately outside | |
| // the switch rather than a `default` so that the linter will flag the | |
| // switch as needing an update. | |
| // ignore: dead_code | |
| return gmaps.MapTypeId.ROADMAP; |
In this case I would suggest making the function return a nullable value so the fallback can be null, and then at the call site checking that this returns a non-null value before setting the value in the options class.
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.
Good point! Done.
| sdk: flutter | ||
| flutter_web_plugins: | ||
| sdk: flutter | ||
| google_maps: ^8.0.0 |
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.
Looks like the MapOptions fields this PR is using were added in 8.1.0, which is why downgraded analysis is failing.
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! done.
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.
LGTM if Stuart's comments are addressed
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.
LGTM
|
hey @stuartmorgan-g I updated the PR with your points. |
flutter/packages@5d785a0...42bb347 2025-09-03 james@somethingwild.co.nz [google_maps_flutter] Fixes exception when dispose is called while asynchronous update from didUpdateWidget is executed (flutter/packages#9227) 2025-09-03 monteiroamelo@gmail.com [google_maps_flutter] Add cameraControl enable/disable & position on web (flutter/packages#9089) 2025-09-03 stuartmorgan@google.com [tool] Only license-check checked-in files (flutter/packages#9905) 2025-09-03 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Fixes preloading ad while another was playing on Android (flutter/packages#9904) 2025-09-02 31859944+LongCatIsLooong@users.noreply.github.com Update FWFWebViewFlutterWKWebViewExternalAPITests.swift (flutter/packages#9922) 2025-09-02 31859944+LongCatIsLooong@users.noreply.github.com Update Stubs for FlutterPluginRegistrar interface change (flutter/packages#9923) 2025-09-02 43054281+camsim99@users.noreply.github.com [camera_android_camerax] Update Android minimum SDK version (flutter/packages#9945) 2025-09-02 engine-flutter-autoroll@skia.org Roll Flutter from da5523a to 6b18740 (49 revisions) (flutter/packages#9926) 2025-09-02 stuartmorgan@google.com [various] Scrub pre-iOS-13 code (flutter/packages#9849) 2025-09-02 monteiroamelo@gmail.com [google_maps_flutter_web] Add cameraControl enable/disable & position on web (flutter/packages#9921) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…er#174876) flutter/packages@5d785a0...42bb347 2025-09-03 james@somethingwild.co.nz [google_maps_flutter] Fixes exception when dispose is called while asynchronous update from didUpdateWidget is executed (flutter/packages#9227) 2025-09-03 monteiroamelo@gmail.com [google_maps_flutter] Add cameraControl enable/disable & position on web (flutter/packages#9089) 2025-09-03 stuartmorgan@google.com [tool] Only license-check checked-in files (flutter/packages#9905) 2025-09-03 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Fixes preloading ad while another was playing on Android (flutter/packages#9904) 2025-09-02 31859944+LongCatIsLooong@users.noreply.github.com Update FWFWebViewFlutterWKWebViewExternalAPITests.swift (flutter/packages#9922) 2025-09-02 31859944+LongCatIsLooong@users.noreply.github.com Update Stubs for FlutterPluginRegistrar interface change (flutter/packages#9923) 2025-09-02 43054281+camsim99@users.noreply.github.com [camera_android_camerax] Update Android minimum SDK version (flutter/packages#9945) 2025-09-02 engine-flutter-autoroll@skia.org Roll Flutter from da5523a to 6b18740 (49 revisions) (flutter/packages#9926) 2025-09-02 stuartmorgan@google.com [various] Scrub pre-iOS-13 code (flutter/packages#9849) 2025-09-02 monteiroamelo@gmail.com [google_maps_flutter_web] Add cameraControl enable/disable & position on web (flutter/packages#9921) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…er#174876) flutter/packages@5d785a0...42bb347 2025-09-03 james@somethingwild.co.nz [google_maps_flutter] Fixes exception when dispose is called while asynchronous update from didUpdateWidget is executed (flutter/packages#9227) 2025-09-03 monteiroamelo@gmail.com [google_maps_flutter] Add cameraControl enable/disable & position on web (flutter/packages#9089) 2025-09-03 stuartmorgan@google.com [tool] Only license-check checked-in files (flutter/packages#9905) 2025-09-03 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Fixes preloading ad while another was playing on Android (flutter/packages#9904) 2025-09-02 31859944+LongCatIsLooong@users.noreply.github.com Update FWFWebViewFlutterWKWebViewExternalAPITests.swift (flutter/packages#9922) 2025-09-02 31859944+LongCatIsLooong@users.noreply.github.com Update Stubs for FlutterPluginRegistrar interface change (flutter/packages#9923) 2025-09-02 43054281+camsim99@users.noreply.github.com [camera_android_camerax] Update Android minimum SDK version (flutter/packages#9945) 2025-09-02 engine-flutter-autoroll@skia.org Roll Flutter from da5523a to 6b18740 (49 revisions) (flutter/packages#9926) 2025-09-02 stuartmorgan@google.com [various] Scrub pre-iOS-13 code (flutter/packages#9849) 2025-09-02 monteiroamelo@gmail.com [google_maps_flutter_web] Add cameraControl enable/disable & position on web (flutter/packages#9921) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Platform web portion of #9089.
Part of flutter/flutter#167137
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith 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.mdto 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-assistbot 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