-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[google_maps_flutter] Add liteModeEnabled option #2449
Conversation
Update master
Update master
Update from master
Update master
Update master
Update master
Update master
Update master
Update master
update master
Update master
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!
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. |
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.
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.
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.
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'); |
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.
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.
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.
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?
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.
+1 @sanekyy
@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) |
@ramsestom 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
@amirh Hi! Could you merge this PR? |
# Conflicts: # packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
}) { | ||
assert(liteModeEnabled == null || | ||
!liteModeEnabled || | ||
(liteModeEnabled && Platform.isAndroid)); |
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.
nit: what about leaving this as a noop if !Platform.isAndroid
?
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.
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.
@cyanglaz is there anything else left in this PR? |
packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart
Show resolved
Hide resolved
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.
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?
@cyanglaz Ok. I will make it. I waiting for landing about half of year 🤓 |
# 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
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
…-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)
I created a follow-up PR to this one, here: #2798 |
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.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?