Skip to content

[google_maps_flutter_web] Adds missing MapOptions parameters. #4553

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

Closed
wants to merge 6 commits into from

Conversation

Franreno
Copy link
Contributor

@Franreno Franreno commented Jul 23, 2023

As the linked issue states, there are some MapOptions parameters that can't be modified on the MapConfiguration when using google_maps_flutter_web package.

The parameters are:

  • mapTypeControl: Enables the user to change mapTypes.
  • fullscreenControl: Enables the user make the map fullscreen.
  • streetViewControl: Enables the user to use the streetview functionality.

There parameters where previously set to false by default at the MapConfiguration class. With this Pull Request, these parameters could be setted to true or false.

As the previous version handles these options as false by default, I opted to keep them as false if the user has not setted them to true.

Using this approach and creating a simple example app that uses this new implementation, we can see that these new controllers can be used on the google_maps_flutter_web package.

new_options_parameters.mp4

Fixes #104111

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@ditman
Copy link
Member

ditman commented Jul 24, 2023

@Franreno these web-only options are a little bit unexpected. We're deciding on how to best land this. We might have to create a new WebMapConfiguration type to group together all the web-only config: the 3 values you're adding + fortyFiveDegreeImagery and webGestureHandling that have landed very recently (in fact they're still not available from the core plugin).

@ditman
Copy link
Member

ditman commented Jul 24, 2023

(Discussed on chat with @stuartmorgan and we decided to go with the PRs as they are, and then maybe do a more thorough refactor of per-platform settings, for example "liteMode" doesn't make sense in the web or iOS either)

@ditman
Copy link
Member

ditman commented Jul 24, 2023

@Franreno there's some automated "checks" failing, please work on the branch until all automated checks pass, otherwise we can't merge it. Currently, there's the following warnings/errors being reported:

Analyzing google_maps_flutter_web...

  error - example/integration_test/google_maps_controller_test.dart:411:13 - The named parameter 'mapTypeControl' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'mapTypeControl'. - undefined_named_parameter
  error - example/integration_test/google_maps_controller_test.dart:412:13 - The named parameter 'fullscreenControl' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'fullscreenControl'. - undefined_named_parameter
  error - example/integration_test/google_maps_controller_test.dart:413:13 - The named parameter 'streetViewControl' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'streetViewControl'. - undefined_named_parameter
  error - lib/src/convert.dart:77:42 - The getter 'mapTypeControl' isn't defined for the type 'MapConfiguration'. Try importing the library that defines 'mapTypeControl', correcting the name to the name of an existing getter, or defining a getter or field named 'mapTypeControl'. - undefined_getter
  error - lib/src/convert.dart:78:45 - The getter 'fullscreenControl' isn't defined for the type 'MapConfiguration'. Try importing the library that defines 'fullscreenControl', correcting the name to the name of an existing getter, or defining a getter or field named 'fullscreenControl'. - undefined_getter
  error - lib/src/convert.dart:79:45 - The getter 'streetViewControl' isn't defined for the type 'MapConfiguration'. Try importing the library that defines 'streetViewControl', correcting the name to the name of an existing getter, or defining a getter or field named 'streetViewControl'. - undefined_getter
   info - example/integration_test/google_maps_controller_test.dart:410:33 - The value of the argument is redundant because it matches the default value. Try removing the argument. - avoid_redundant_argument_values

7 issues found.

You can find more on the "View more" link of each check (search for the stdout of the failing step).

In this case, the analyzer is complaining about missing types because this PR isn't setup with the correct dependencies. Read instructions on how this PR needs to be configured here:

@ditman
Copy link
Member

ditman commented Jul 24, 2023

(Moving this to draft until it's more ready to review!)

@ditman ditman marked this pull request as draft July 24, 2023 22:25
@Franreno
Copy link
Contributor Author

Hello @ditman, I really appreciate your suggestions and thank you for helping me!

(Discussed on chat with @stuartmorgan and we decided to go with the PRs as they are, and then maybe do a more thorough refactor of per-platform settings, for example "liteMode" doesn't make sense in the web or iOS either)

As your comment states, this PR would be valid if the tests are passing? If so, only the web google maps would receive these new parameters?

I'm currently working to get the tests fixed!
As always, thank you for your help.

@Franreno
Copy link
Contributor Author

@ditman I think the version_check check is failing because I haven't updated the changelogs for the other packages that were included in the dependancies override. If I shall update them, please, let me know.

@stuartmorgan-g
Copy link
Contributor

@ditman I think the version_check check is failing because I haven't updated the changelogs for the other packages that were included in the dependancies override. If I shall update them, please, let me know.

Packages that don't actually need dependency overrides should just have the dependency overrides reverted.

@Franreno
Copy link
Contributor Author

Packages that don't actually need dependency overrides should just have the dependency overrides reverted.

I have reverted the other packages that didn't needed the dependancies overrides.

The only checks failing are the submit-queue and the Linux repo_checks. I think the repo_checks failing is supposed to happen because I'm making changes to the platform_interface package. But I don't know why the submit-queue is failing.

@stuartmorgan-g
Copy link
Contributor

But I don't know why the submit-queue is failing.

It's unrelated to the PR; see https://github.com/flutter/flutter/wiki/Understanding-Packages-tests#specific-tests

@Franreno
Copy link
Contributor Author

Oh okay! Thanks!

@Franreno
Copy link
Contributor Author

Franreno commented Jul 25, 2023

Would this PR be valid for review now? If there is anything else that I need to do let me know.

@ditman ditman marked this pull request as ready for review July 25, 2023 19:47
@ditman
Copy link
Member

ditman commented Jul 25, 2023

Yes, this is ready for review now @Franreno, thanks for keeping the CI happy!

Copy link
Contributor

@reidbaker reidbaker left a comment

Choose a reason for hiding this comment

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

Android +1

@@ -107,6 +110,16 @@ class MapConfiguration {
/// True if 3D building display should be enabled.
final bool? buildingsEnabled;

/// True if the control to toggle between map types should be displayed.
final bool? mapTypeControl;
Copy link
Contributor

Choose a reason for hiding this comment

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

These should all end with Enabled, like the existing comparable properties.

@@ -32,3 +32,8 @@ flutter:
uses-material-design: true
assets:
- assets/

# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert the changes to google_maps_flutter_android and google_maps_flutter_ios.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why aren't there any actual changes in this package? Isn't the intent of the PR to allow clients of google_maps_flutter to configure these options?

@@ -403,6 +403,30 @@ void main() {
expect(capturedOptions!.tilt, 0);
});

testWidgets(
'translates mapTypeControl, fullscreenControl, streetViewControl configurations',
Copy link
Contributor

Choose a reason for hiding this comment

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

Three unrelated things should not be tested in the same test.

@@ -1,3 +1,7 @@
## 2.4.1
Copy link
Contributor

Choose a reason for hiding this comment

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

New functionality is a minor update, not a bugfix update.

@@ -2,7 +2,7 @@ name: google_maps_flutter_web
description: Web platform implementation of google_maps_flutter
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
version: 0.5.2
version: 0.5.2+1
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here; this should be 0.5.3.

@reidbaker
Copy link
Contributor

@Franreno is this still something you are planning to work on?

@stuartmorgan-g
Copy link
Contributor

Thank you for your contribution. I'm going to close this PR for now since there are outstanding comments, just to get this off our PR review queue. Please don't hesitate to submit a new PR if you have the time to address the review comments. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[google_maps_flutter_web] Add missing MapOptions parameters
4 participants