-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[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
Changes from 7 commits
b4cc5f8
9281be8
25020bf
f2fe01d
b2d1d89
a5a5ff5
14a12bf
59403c3
a674307
67f8332
89fc4c4
34bdf2c
ce994ae
1e1e19f
c104583
2857f31
48769d3
bc8995c
e1baafe
c2db98a
f39f172
1c43687
8251ab0
e919f3d
e8bbbb5
a53dea0
bfa3f44
2296090
aff20e2
e3a17f9
a4c3b7c
bd44dad
347538e
e11955e
ba9375e
6c54f61
c7bf6d7
eba680c
9d7d258
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,6 +95,8 @@ class GoogleMap extends StatefulWidget { | |
| this.onMapCreated, | ||
| this.gestureRecognizers = const <Factory<OneSequenceGestureRecognizer>>{}, | ||
| this.webGestureHandling, | ||
| this.webCameraControlPosition, | ||
| this.webCameraControlEnabled = true, | ||
| this.compassEnabled = true, | ||
| this.mapToolbarEnabled = true, | ||
| this.cameraTargetBounds = CameraTargetBounds.unbounded, | ||
|
|
@@ -349,6 +351,16 @@ class GoogleMap extends StatefulWidget { | |
| /// See [WebGestureHandling] for more details. | ||
| final WebGestureHandling? webGestureHandling; | ||
|
|
||
| /// This setting controls how the API handles cameraControl button position on the map. Web only. | ||
| /// | ||
| /// See [WebCameraControlPosition] for more details. | ||
| 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; | ||
|
|
||
| /// Identifier that's associated with a specific cloud-based map style. | ||
| /// | ||
| /// See https://developers.google.com/maps/documentation/get-map-id | ||
|
|
@@ -652,6 +664,8 @@ class _GoogleMapState extends State<GoogleMap> { | |
| /// Builds a [MapConfiguration] from the given [map]. | ||
| MapConfiguration _configurationFromMapWidget(GoogleMap map) { | ||
| return MapConfiguration( | ||
| webCameraControlPosition: map.webCameraControlPosition, | ||
| webCameraControlEnabled: map.webCameraControlEnabled, | ||
| webGestureHandling: map.webGestureHandling, | ||
| compassEnabled: map.compassEnabled, | ||
| mapToolbarEnabled: map.mapToolbarEnabled, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ name: google_maps_flutter | |
| description: A Flutter plugin for integrating Google Maps in iOS and Android applications. | ||
| repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter | ||
| issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 | ||
| version: 2.12.1 | ||
| version: 2.12.2 | ||
|
||
|
|
||
| environment: | ||
| sdk: ^3.6.0 | ||
|
|
@@ -26,6 +26,12 @@ dependencies: | |
| google_maps_flutter_platform_interface: ^2.11.0 | ||
| google_maps_flutter_web: ^0.5.12 | ||
|
|
||
| # FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. | ||
| # See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins | ||
| dependency_overrides: | ||
| google_maps_flutter_platform_interface: {path: ../../../packages/google_maps_flutter/google_maps_flutter_platform_interface} | ||
| google_maps_flutter_web: {path: ../../../packages/google_maps_flutter/google_maps_flutter_web} | ||
|
|
||
| dev_dependencies: | ||
| flutter_test: | ||
| sdk: flutter | ||
|
|
||
|
Collaborator
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. All of the
Collaborator
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. Please revert the newline removals from the Android and iOS pubspecs.
Contributor
Author
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. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 2.11.2 | ||
|
|
||
| * Adds support to camera control button on web. | ||
|
||
|
|
||
| ## 2.11.1 | ||
|
|
||
| * Updates READMEs and API docs. | ||
|
|
||
| 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,16 @@ 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. | ||
| /// | ||
| /// See [WebCameraControlPosition] for more details. | ||
|
Collaborator
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.
Contributor
Author
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 +135,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 +208,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 +243,8 @@ class MapConfiguration { | |
|
|
||
| /// True if no options are set. | ||
| bool get isEmpty => | ||
| webCameraControlPosition == null && | ||
| webCameraControlEnabled == null && | ||
| webGestureHandling == null && | ||
| compassEnabled == null && | ||
| mapToolbarEnabled == null && | ||
|
|
@@ -251,6 +277,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 +306,8 @@ class MapConfiguration { | |
| @override | ||
| int get hashCode => Object.hashAll(<Object?>[ | ||
| webGestureHandling, | ||
| webCameraControlPosition, | ||
| webCameraControlEnabled, | ||
| compassEnabled, | ||
| mapToolbarEnabled, | ||
| cameraTargetBounds, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.