-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[google_maps_flutter_platform_interface] Platform interface changes for #3258 #4478
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
Merged
auto-submit
merged 7 commits into
flutter:main
from
Rexios80:google-maps-more-web-config-options-platform-interface
Jul 17, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cc80903
Platform interface changes for #3258
Rexios80 f59558c
Merge branch 'main' into google-maps-more-web-config-options-platform…
Rexios80 44640ae
Adds tests
Rexios80 2ccf1fa
Fixes
Rexios80 c144efe
Adding more tests
Rexios80 493210d
Merge remote-tracking branch 'upstream/main' into google-maps-more-we…
Rexios80 9c9cc16
Update versions
Rexios80 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
|
|
||
| import 'package:flutter/widgets.dart'; | ||
|
|
||
| import 'ui.dart'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing |
||
| import '../../google_maps_flutter_platform_interface.dart'; | ||
|
Rexios80 marked this conversation as resolved.
|
||
|
|
||
| /// Configuration options for the GoogleMaps user interface. | ||
| @immutable | ||
|
|
@@ -15,6 +15,7 @@ class MapConfiguration { | |
| /// as either a full configuration selection, or an update to an existing | ||
| /// configuration where only non-null values are updated. | ||
| const MapConfiguration({ | ||
| this.webGestureHandling, | ||
| this.compassEnabled, | ||
| this.mapToolbarEnabled, | ||
| this.cameraTargetBounds, | ||
|
|
@@ -23,6 +24,7 @@ class MapConfiguration { | |
| this.rotateGesturesEnabled, | ||
| this.scrollGesturesEnabled, | ||
| this.tiltGesturesEnabled, | ||
| this.fortyFiveDegreeImageryEnabled, | ||
| this.trackCameraPosition, | ||
| this.zoomControlsEnabled, | ||
| this.zoomGesturesEnabled, | ||
|
|
@@ -36,6 +38,11 @@ class MapConfiguration { | |
| this.cloudMapId, | ||
| }); | ||
|
|
||
| /// This setting controls how the API handles gestures on the map. Web only. | ||
| /// | ||
| /// See [WebGestureHandling] for more details. | ||
| final WebGestureHandling? webGestureHandling; | ||
|
|
||
| /// True if the compass UI should be shown. | ||
| final bool? compassEnabled; | ||
|
|
||
|
|
@@ -48,25 +55,34 @@ class MapConfiguration { | |
| /// The type of the map. | ||
| final MapType? mapType; | ||
|
|
||
| /// The prefered zoom range. | ||
| /// The preferred zoom range. | ||
| final MinMaxZoomPreference? minMaxZoomPreference; | ||
|
|
||
| /// True if rotate gestures should be enabled. | ||
| final bool? rotateGesturesEnabled; | ||
|
|
||
| /// True if scroll gestures should be enabled. | ||
| /// | ||
| /// Android/iOS only. For web, see [webGestureHandling]. | ||
| final bool? scrollGesturesEnabled; | ||
|
|
||
| /// True if tilt gestures should be enabled. | ||
| final bool? tiltGesturesEnabled; | ||
|
|
||
| /// True if 45 degree imagery should be enabled. | ||
| /// | ||
| /// Web only. | ||
| final bool? fortyFiveDegreeImageryEnabled; | ||
|
|
||
| /// True if camera position changes should trigger notifications. | ||
| final bool? trackCameraPosition; | ||
|
|
||
| /// True if zoom controls should be displayed. | ||
| final bool? zoomControlsEnabled; | ||
|
|
||
| /// True if zoom gestures should be enabled. | ||
| /// | ||
| /// Android/iOS only. For web, see [webGestureHandling]. | ||
| final bool? zoomGesturesEnabled; | ||
|
|
||
| /// True if the map should use Lite Mode, showing a limited-interactivity | ||
|
|
@@ -101,6 +117,9 @@ class MapConfiguration { | |
| /// that are different from [other]. | ||
| MapConfiguration diffFrom(MapConfiguration other) { | ||
| return MapConfiguration( | ||
| webGestureHandling: webGestureHandling != other.webGestureHandling | ||
| ? webGestureHandling | ||
| : null, | ||
| compassEnabled: | ||
| compassEnabled != other.compassEnabled ? compassEnabled : null, | ||
| mapToolbarEnabled: mapToolbarEnabled != other.mapToolbarEnabled | ||
|
|
@@ -124,6 +143,10 @@ class MapConfiguration { | |
| tiltGesturesEnabled: tiltGesturesEnabled != other.tiltGesturesEnabled | ||
| ? tiltGesturesEnabled | ||
| : null, | ||
| fortyFiveDegreeImageryEnabled: | ||
| fortyFiveDegreeImageryEnabled != other.fortyFiveDegreeImageryEnabled | ||
| ? fortyFiveDegreeImageryEnabled | ||
| : null, | ||
| trackCameraPosition: trackCameraPosition != other.trackCameraPosition | ||
| ? trackCameraPosition | ||
| : null, | ||
|
|
@@ -158,6 +181,7 @@ class MapConfiguration { | |
| /// replacing the previous values. | ||
| MapConfiguration applyDiff(MapConfiguration diff) { | ||
| return MapConfiguration( | ||
| webGestureHandling: diff.webGestureHandling ?? webGestureHandling, | ||
| compassEnabled: diff.compassEnabled ?? compassEnabled, | ||
| mapToolbarEnabled: diff.mapToolbarEnabled ?? mapToolbarEnabled, | ||
| cameraTargetBounds: diff.cameraTargetBounds ?? cameraTargetBounds, | ||
|
|
@@ -168,6 +192,8 @@ class MapConfiguration { | |
| scrollGesturesEnabled: | ||
| diff.scrollGesturesEnabled ?? scrollGesturesEnabled, | ||
| tiltGesturesEnabled: diff.tiltGesturesEnabled ?? tiltGesturesEnabled, | ||
| fortyFiveDegreeImageryEnabled: | ||
| diff.fortyFiveDegreeImageryEnabled ?? fortyFiveDegreeImageryEnabled, | ||
| trackCameraPosition: diff.trackCameraPosition ?? trackCameraPosition, | ||
| zoomControlsEnabled: diff.zoomControlsEnabled ?? zoomControlsEnabled, | ||
| zoomGesturesEnabled: diff.zoomGesturesEnabled ?? zoomGesturesEnabled, | ||
|
|
@@ -185,6 +211,7 @@ class MapConfiguration { | |
|
|
||
| /// True if no options are set. | ||
| bool get isEmpty => | ||
| webGestureHandling == null && | ||
| compassEnabled == null && | ||
| mapToolbarEnabled == null && | ||
| cameraTargetBounds == null && | ||
|
|
@@ -193,6 +220,7 @@ class MapConfiguration { | |
| rotateGesturesEnabled == null && | ||
| scrollGesturesEnabled == null && | ||
| tiltGesturesEnabled == null && | ||
| fortyFiveDegreeImageryEnabled == null && | ||
| trackCameraPosition == null && | ||
| zoomControlsEnabled == null && | ||
| zoomGesturesEnabled == null && | ||
|
|
@@ -214,6 +242,7 @@ class MapConfiguration { | |
| return false; | ||
| } | ||
| return other is MapConfiguration && | ||
| webGestureHandling == other.webGestureHandling && | ||
| compassEnabled == other.compassEnabled && | ||
| mapToolbarEnabled == other.mapToolbarEnabled && | ||
| cameraTargetBounds == other.cameraTargetBounds && | ||
|
|
@@ -222,6 +251,7 @@ class MapConfiguration { | |
| rotateGesturesEnabled == other.rotateGesturesEnabled && | ||
| scrollGesturesEnabled == other.scrollGesturesEnabled && | ||
| tiltGesturesEnabled == other.tiltGesturesEnabled && | ||
| fortyFiveDegreeImageryEnabled == other.fortyFiveDegreeImageryEnabled && | ||
| trackCameraPosition == other.trackCameraPosition && | ||
| zoomControlsEnabled == other.zoomControlsEnabled && | ||
| zoomGesturesEnabled == other.zoomGesturesEnabled && | ||
|
|
@@ -236,7 +266,8 @@ class MapConfiguration { | |
| } | ||
|
|
||
| @override | ||
| int get hashCode => Object.hash( | ||
| int get hashCode => Object.hashAll(<Object?>[ | ||
| webGestureHandling, | ||
| compassEnabled, | ||
| mapToolbarEnabled, | ||
| cameraTargetBounds, | ||
|
|
@@ -245,6 +276,7 @@ class MapConfiguration { | |
| rotateGesturesEnabled, | ||
| scrollGesturesEnabled, | ||
| tiltGesturesEnabled, | ||
| fortyFiveDegreeImageryEnabled, | ||
| trackCameraPosition, | ||
| zoomControlsEnabled, | ||
| zoomGesturesEnabled, | ||
|
|
@@ -256,5 +288,5 @@ class MapConfiguration { | |
| trafficEnabled, | ||
| buildingsEnabled, | ||
| cloudMapId, | ||
| ); | ||
| ]); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ps_flutter/google_maps_flutter_platform_interface/lib/src/types/web_gesture_handling.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| /// This setting controls how the API handles gestures on the map | ||
| enum WebGestureHandling { | ||
| /// Scroll events and one-finger touch gestures scroll the page, and do not | ||
| /// zoom or pan the map. Two-finger touch gestures pan and zoom the map. | ||
| /// Scroll events with a ctrl key or ⌘ key pressed zoom the map. In this mode | ||
| /// the map cooperates with the page. | ||
| cooperative, | ||
|
|
||
| /// All touch gestures and scroll events pan or zoom the map. | ||
| greedy, | ||
|
|
||
| /// The map cannot be panned or zoomed by user gestures. | ||
| none, | ||
|
|
||
| /// (default) Gesture handling is either cooperative or greedy, depending on | ||
| /// whether the page is scrollable or in an iframe. | ||
| auto, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.