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

[google_maps_flutter] Add liteModeEnabled option #2449

Merged
merged 50 commits into from
May 19, 2020

Conversation

otopba
Copy link
Contributor

@otopba otopba commented Jan 7, 2020

Description

Add liteModeEnabled option

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?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@otopba otopba requested a review from cyanglaz January 19, 2020 13:30
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!
Thanks, this is great. I left a few nits.

@@ -91,6 +92,9 @@ class GoogleMap extends StatefulWidget {
/// True if the map view should respond to zoom gestures.
final bool zoomGesturesEnabled;

/// True if the map view should be in lite mode. Android only. See https://developers.google.com/maps/documentation/android-sdk/lite#overview_of_lite_mode for more details.
Copy link
Contributor

Choose a reason for hiding this comment

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

nits: The See.. should be at its own paragraph.

/// True if the map view should be in lite mode. Android only.
///
/// See https://developers.google.com/maps/documentation/android-sdk/lite#overview_of_lite_mode for more details.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -472,6 +480,10 @@ class _GoogleMapOptions {
addIfNonNull('scrollGesturesEnabled', scrollGesturesEnabled);
addIfNonNull('tiltGesturesEnabled', tiltGesturesEnabled);
addIfNonNull('zoomGesturesEnabled', zoomGesturesEnabled);
addIfNonNull('liteModeEnabled', liteModeEnabled);
if (liteModeEnabled != null && liteModeEnabled && !Platform.isAndroid) {
print('Warning: liteModeEnabled is Android only');
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of printing a warning message, what do you think about adding an assert(with warning message) here so developers can encounter a crash in debug mode. This way we are sure the developers know that this is android only.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thus if developers knows about this behaviour and consciously want to use maps on Android with enabled light mode and disabled on iOS they should write platform specific code in their app to avoid crashes in debug mode.

Something like this:

Map(
  liteModeEnabled: Platform.isAndroid,
);

Is this the right approach to working with plugins?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amirh
Copy link
Contributor

amirh commented Jan 21, 2020

@otopba I'm assuming you're adding this feature as you want to use it in your app. I'm curious what is your plan for iOS ?

(I'm mainly asking to augment the discussion around what to do with this parameter on iOS)

@otopba
Copy link
Contributor Author

otopba commented Feb 12, 2020

@ramsestom
"The Maps SDK for Android can serve a bitmap image of a map, offering limited interactivity to the user. This is called a lite mode map."

You are not right. It is very lite view

https://developers.google.com/maps/documentation/android-sdk/lite

# Conflicts:
#	packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
#	packages/google_maps_flutter/google_maps_flutter/pubspec.yaml
@otopba
Copy link
Contributor Author

otopba commented Feb 24, 2020

@amirh Hi! Could you merge this PR?

@otopba otopba requested a review from cyanglaz March 22, 2020 19:19
@iskakaushik iskakaushik removed their request for review April 28, 2020 16:37
}) {
assert(liteModeEnabled == null ||
!liteModeEnabled ||
(liteModeEnabled && Platform.isAndroid));
Copy link

Choose a reason for hiding this comment

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

nit: what about leaving this as a noop if !Platform.isAndroid?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can leave it as is, an assertion helps the user to be more explicit when using liteMode so they are aware it doesn't work on iOS.

@blasten
Copy link

blasten commented May 15, 2020

@cyanglaz is there anything else left in this PR?

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.

Let's rebase this and try to land it. @otopba We also need to add this param in the platform interface, do you want to do that too?

@otopba
Copy link
Contributor Author

otopba commented May 15, 2020

@cyanglaz Ok. I will make it. I waiting for landing about half of year 🤓

otopba added 2 commits May 15, 2020 19:56
# Conflicts:
#	packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
#	packages/google_maps_flutter/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java
#	packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart
#	packages/google_maps_flutter/google_maps_flutter/example/test_driver/google_map_inspector.dart
#	packages/google_maps_flutter/google_maps_flutter/example/test_driver/google_maps_e2e.dart
#	packages/google_maps_flutter/google_maps_flutter/pubspec.yaml
#	packages/google_maps_flutter/google_maps_flutter/test/fake_maps_controllers.dart
@otopba
Copy link
Contributor Author

otopba commented May 15, 2020

@cyanglaz
@blasten
Done

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

@cyanglaz cyanglaz merged commit 82f8f49 into flutter:master May 19, 2020
KevinTheGray added a commit to KevinTheGray/plugins that referenced this pull request May 19, 2020
…-player-plugin-fix

* commit '25a585dfeef6d2dc224fd0dddee327372de63782':
  [image_picker] iOS: fix bug, sometimes double click cancel button will crash (flutter#2625)
  [google_maps_flutter] Add liteModeEnabled option (flutter#2449)
  Update README.md (flutter#2768)
  [url_launcher_web] Launch mailto urls in same window in Safari (flutter#2740)
  update README with enableJavaScript info (flutter#2766)
  Run publish ci check on master (flutter#2764)
  [image_picker] Add documentation for Android external storage permissions (flutter#2765)
@ditman
Copy link
Member

ditman commented May 26, 2020

I created a follow-up PR to this one, here: #2798

EdwinRomelta pushed a commit to EdwinRomelta/plugins that referenced this pull request Jun 11, 2020
jorgefspereira pushed a commit to jorgefspereira/plugins_flutter that referenced this pull request Oct 10, 2020
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
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.

8 participants