-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[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
base: main
Are you sure you want to change the base?
Changes from all commits
b4cc5f8
9281be8
25020bf
f2fe01d
b2d1d89
a5a5ff5
14a12bf
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. | ||
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. Have a more descriptive comment here. Something like "Enables or disables the Camera controls." |
||
/// | ||
/// 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 | ||
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. As indicated in the PR checklist, we follow semver, which requires changing the minor version when adding public API. |
||
|
||
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 | ||
|
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 |
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. | ||
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. "Adds support for disabling or moving the 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. | ||
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. |
||
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, | ||
|
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.