-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[google_maps_flutter] Add cameraControl enable/disable & position on web #9089
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
Open
4rthurmonteiro
wants to merge
15
commits into
flutter:main
Choose a base branch
from
4rthurmonteiro:feat/camera_control
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+380
−12
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b4cc5f8
feat: camera control on web
4rthurmonteiro 9281be8
chore: update map_configuration_test.dart
4rthurmonteiro 25020bf
chore: add dependecy_overrides
4rthurmonteiro f2fe01d
Merge remote-tracking branch 'upstream/main' into feat/camera_control
4rthurmonteiro b2d1d89
chore(step-1): make-deps-path-based
4rthurmonteiro a5a5ff5
chore(changelog): merge with upstream
4rthurmonteiro 14a12bf
Merge branch 'main' into feat/camera_control
4rthurmonteiro 59403c3
Merge branch 'main' into feat/camera_control
4rthurmonteiro a674307
chore: fix minor
4rthurmonteiro 67f8332
chore: improve webCameraControlEnabled description
4rthurmonteiro 89fc4c4
chore: add doc for WebCameraControlPosition? when is null
4rthurmonteiro 34bdf2c
chore: update changelog
4rthurmonteiro ce994ae
chore: remove duplicated doc
4rthurmonteiro 1e1e19f
fix: google_maps_flutter changelog
4rthurmonteiro c104583
chore: remove overrides
4rthurmonteiro 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
4 changes: 4 additions & 0 deletions
4
packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
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
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
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
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 |
---|---|---|
|
@@ -32,4 +32,4 @@ dev_dependencies: | |
flutter: | ||
uses-material-design: true | ||
assets: | ||
- assets/ | ||
- assets/ |
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 |
---|---|---|
|
@@ -36,4 +36,4 @@ dev_dependencies: | |
topics: | ||
- google-maps | ||
- google-maps-flutter | ||
- map | ||
- map |
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 |
---|---|---|
|
@@ -31,4 +31,4 @@ dev_dependencies: | |
flutter: | ||
uses-material-design: true | ||
assets: | ||
- assets/ | ||
- assets/ |
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 |
---|---|---|
|
@@ -31,4 +31,4 @@ dev_dependencies: | |
flutter: | ||
uses-material-design: true | ||
assets: | ||
- assets/ | ||
- assets/ |
4 changes: 4 additions & 0 deletions
4
packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md
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 |
---|---|---|
|
@@ -15,6 +15,8 @@ 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.webCameraControlPosition, | ||
this.webCameraControlEnabled, | ||
this.webGestureHandling, | ||
this.compassEnabled, | ||
this.mapToolbarEnabled, | ||
|
@@ -44,6 +46,18 @@ class MapConfiguration { | |
/// See [WebGestureHandling] for more details. | ||
final WebGestureHandling? webGestureHandling; | ||
|
||
/// This setting controls how the API handles cameraControl button position on the map. Web only. | ||
/// | ||
/// If null, the Google Maps API will use its default camera control position. | ||
/// | ||
/// See [WebCameraControlPosition] for more details. | ||
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. Same comment here; the null behavior should be documented. 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. done. |
||
final WebCameraControlPosition? webCameraControlPosition; | ||
|
||
/// This setting controls how the API handles cameraControl button on the map. Web only. | ||
/// | ||
/// See https://developers.google.com/maps/documentation/javascript/controls for more details. | ||
final bool? webCameraControlEnabled; | ||
|
||
/// True if the compass UI should be shown. | ||
final bool? compassEnabled; | ||
|
||
|
@@ -123,6 +137,14 @@ class MapConfiguration { | |
/// that are different from [other]. | ||
MapConfiguration diffFrom(MapConfiguration other) { | ||
return MapConfiguration( | ||
webCameraControlPosition: | ||
webCameraControlPosition != other.webCameraControlPosition | ||
? webCameraControlPosition | ||
: null, | ||
webCameraControlEnabled: | ||
webCameraControlEnabled != other.webCameraControlEnabled | ||
? webCameraControlEnabled | ||
: null, | ||
webGestureHandling: webGestureHandling != other.webGestureHandling | ||
? webGestureHandling | ||
: null, | ||
|
@@ -188,6 +210,10 @@ class MapConfiguration { | |
/// replacing the previous values. | ||
MapConfiguration applyDiff(MapConfiguration diff) { | ||
return MapConfiguration( | ||
webCameraControlPosition: | ||
diff.webCameraControlPosition ?? webCameraControlPosition, | ||
webCameraControlEnabled: | ||
diff.webCameraControlEnabled ?? webCameraControlEnabled, | ||
webGestureHandling: diff.webGestureHandling ?? webGestureHandling, | ||
compassEnabled: diff.compassEnabled ?? compassEnabled, | ||
mapToolbarEnabled: diff.mapToolbarEnabled ?? mapToolbarEnabled, | ||
|
@@ -219,6 +245,8 @@ class MapConfiguration { | |
|
||
/// True if no options are set. | ||
bool get isEmpty => | ||
webCameraControlPosition == null && | ||
webCameraControlEnabled == null && | ||
webGestureHandling == null && | ||
compassEnabled == null && | ||
mapToolbarEnabled == null && | ||
|
@@ -251,6 +279,8 @@ class MapConfiguration { | |
return false; | ||
} | ||
return other is MapConfiguration && | ||
webCameraControlPosition == other.webCameraControlPosition && | ||
webCameraControlEnabled == other.webCameraControlEnabled && | ||
webGestureHandling == other.webGestureHandling && | ||
compassEnabled == other.compassEnabled && | ||
mapToolbarEnabled == other.mapToolbarEnabled && | ||
|
@@ -278,6 +308,8 @@ class MapConfiguration { | |
@override | ||
int get hashCode => Object.hashAll(<Object?>[ | ||
webGestureHandling, | ||
webCameraControlPosition, | ||
webCameraControlEnabled, | ||
compassEnabled, | ||
mapToolbarEnabled, | ||
cameraTargetBounds, | ||
|
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
105 changes: 105 additions & 0 deletions
105
...ter/google_maps_flutter_platform_interface/lib/src/types/web_camera_control_position.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,105 @@ | ||
// 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. | ||
|
||
// Identifiers used to specify the placement of controls on the map. | ||
// Controls are positioned relative to other controls in the same layout position. | ||
// Controls that are added first are positioned closer to the edge of the map. | ||
// Usage of "logical values" | ||
// (see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values) | ||
// is recommended in order to be able to automatically support both | ||
// left-to-right (LTR) and right-to-left (RTL) layout contexts. | ||
|
||
// Elements in the top or bottom row flow towards the middle of the row. | ||
// Elements in the left or right column flow towards the middle of the column. | ||
|
||
/// This setting controls how the API handles camera control button on the map | ||
/// See https://developers.google.com/maps/documentation/javascript/reference/control#ControlPosition for more details. | ||
enum WebCameraControlPosition { | ||
/// Equivalent to BOTTOM_CENTER in both LTR and RTL. | ||
blockEndInlineCenter, | ||
|
||
/// Equivalent to BOTTOM_LEFT in LTR, or BOTTOM_RIGHT in RTL. | ||
blockEndInlineStart, | ||
|
||
/// EEquivalent to TOP_RIGHT in LTR, or TOP_LEFT in RTL. | ||
blockEndInlineEnd, | ||
|
||
/// Equivalent to TOP_CENTER in both LTR and RTL. | ||
blockStartInlineCenter, | ||
|
||
/// Equivalent to TOP_LEFT in LTR, or TOP_RIGHT in RTL. | ||
blockStartInlineStart, | ||
|
||
/// Equivalent to TOP_RIGHT in LTR, or TOP_LEFT in RTL. | ||
blockStartInlineEnd, | ||
|
||
/// Elements are positioned in the center of the bottom row. | ||
/// Consider using BLOCK_END_INLINE_CENTER instead. | ||
bottomCenter, | ||
|
||
/// Elements are positioned in the bottom left and flow towards the middle. | ||
/// Elements are positioned to the right of the Google logo. | ||
/// Consider using BLOCK_END_INLINE_START instead. | ||
bottomLeft, | ||
|
||
/// Elements are positioned in the bottom right and flow towards the middle. | ||
/// Elements are positioned to the left of the copyrights. | ||
/// Consider using BLOCK_END_INLINE_END instead. | ||
bottomRight, | ||
|
||
/// Equivalent to RIGHT_CENTER in LTR, or LEFT_CENTER in RTL. | ||
inlineEndBlockCenter, | ||
|
||
/// Equivalent to RIGHT_BOTTOM in LTR, or LEFT_BOTTOM in RTL. | ||
inlineEndBlockEnd, | ||
|
||
/// Equivalent to RIGHT_TOP in LTR, or LEFT_TOP in RTL. | ||
inlineEndBlockStart, | ||
|
||
/// Equivalent to LEFT_CENTER in LTR, or RIGHT_CENTER in RTL. | ||
inlineStartBlockCenter, | ||
|
||
/// Equivalent to LEFT_BOTTOM in LTR, or RIGHT_BOTTOM in RTL. | ||
inlineStartBlockEnd, | ||
|
||
/// Equivalent to LEFT_TOP in LTR, or RIGHT_TOP in RTL. | ||
inlineStartBlockStart, | ||
|
||
/// Elements are positioned on the left, above bottom-left elements, | ||
/// and flow upwards. Consider using INLINE_START_BLOCK_END instead. | ||
leftBottom, | ||
|
||
/// Elements are positioned in the center of the left side. | ||
/// Consider using INLINE_START_BLOCK_CENTER instead. | ||
leftCenter, | ||
|
||
/// Elements are positioned on the left, below top-left elements, | ||
/// and flow downwards. Consider using INLINE_START_BLOCK_START instead. | ||
leftTop, | ||
|
||
/// Elements are positioned on the right, above bottom-right elements, | ||
/// and flow upwards. Consider using INLINE_END_BLOCK_END instead. | ||
rightBottom, | ||
|
||
/// Elements are positioned in the center of the right side. | ||
/// Consider using INLINE_END_BLOCK_CENTER instead. | ||
rightCenter, | ||
|
||
/// Elements are positioned on the right, below top-right elements, | ||
/// and flow downwards. Consider using INLINE_END_BLOCK_START instead. | ||
rightTop, | ||
|
||
/// Elements are positioned in the center of the top row. | ||
/// Consider using BLOCK_START_INLINE_CENTER instead. | ||
topCenter, | ||
|
||
/// Elements are positioned in the top left and flow towards the middle. | ||
/// Consider using BLOCK_START_INLINE_START instead. | ||
topLeft, | ||
|
||
/// Elements are positioned in the top right and flow towards the middle. | ||
/// Consider using BLOCK_START_INLINE_END instead. | ||
topRight, | ||
} |
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
4 changes: 4 additions & 0 deletions
4
packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.5.13 | ||
|
||
* Adds support to camera control button. | ||
|
||
## 0.5.12+2 | ||
|
||
* Fix broken cameraTargetBounds option on web. | ||
|
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
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
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.
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.
The comment should describe what happens if this is null.