From b4cc5f83fa33876221fbf8f55529aa5b878e2e96 Mon Sep 17 00:00:00 2001 From: Arthur Monteiro Date: Tue, 15 Apr 2025 15:34:44 -0300 Subject: [PATCH 1/5] feat: camera control on web --- .../google_maps_flutter/CHANGELOG.md | 4 + .../example/lib/map_ui.dart | 70 +++++++++ .../lib/google_maps_flutter.dart | 1 + .../lib/src/google_map.dart | 14 ++ .../CHANGELOG.md | 4 + .../lib/src/types/map_configuration.dart | 30 ++++ .../lib/src/types/types.dart | 1 + .../types/web_camera_control_position.dart | 143 ++++++++++++++++++ .../google_maps_flutter_web/CHANGELOG.md | 5 + .../lib/src/convert.dart | 66 ++++++++ 10 files changed, 338 insertions(+) create mode 100644 packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/web_camera_control_position.dart diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index fba99c45dbf..e6403620707 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.12.2 + +* Adds support for camera control button on web. + ## 2.12.1 * Fixes typo in README. diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart index 26c0b2ab720..b7b3ec6d3d8 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart @@ -61,6 +61,8 @@ class MapUiBodyState extends State { late GoogleMapController _controller; bool _nightMode = false; String _mapStyle = ''; + bool _webCameraControlEnabled = true; + WebCameraControlPosition? _webCameraControlPosition; @override void initState() { @@ -72,6 +74,67 @@ class MapUiBodyState extends State { super.dispose(); } + Widget _webCameraControlToggler() { + return TextButton( + child: Text( + '${_webCameraControlEnabled ? 'disable' : 'enable'} web camera control'), + onPressed: () { + setState(() { + _webCameraControlEnabled = !_webCameraControlEnabled; + }); + }, + ); + } + + Widget _webCameraControlPositionToggler() { + return TextButton( + onPressed: () => showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Web camera control position'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + DropdownButton( + hint: const Text('Web camera control position'), + value: _webCameraControlPosition, + items: WebCameraControlPosition.values + .map( + (WebCameraControlPosition e) => + DropdownMenuItem( + value: e, + child: Text(e.name), + ), + ) + .toList(), + onChanged: (WebCameraControlPosition? value) { + setState( + () { + _webCameraControlPosition = value; + }, + ); + }, + ), + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Text( + 'Ok', + ), + ) + ], + ), + ); + }, + ), + child: const Text( + 'change web camera control position', + ), + ); + } + Widget _compassToggler() { return TextButton( child: Text('${_compassEnabled ? 'disable' : 'enable'} compass'), @@ -264,6 +327,8 @@ class MapUiBodyState extends State { @override Widget build(BuildContext context) { final GoogleMap googleMap = GoogleMap( + webCameraControlEnabled: _webCameraControlEnabled, + webCameraControlPosition: _webCameraControlPosition, onMapCreated: onMapCreated, initialCameraPosition: _kInitialPosition, compassEnabled: _compassEnabled, @@ -324,6 +389,11 @@ class MapUiBodyState extends State { _myLocationButtonToggler(), _myTrafficToggler(), _nightModeToggler(), + if (kIsWeb) ...[ + _webCameraControlToggler(), + if (_webCameraControlEnabled) + _webCameraControlPositionToggler(), + ] ], ), ), diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart index d24f6f0995f..4fc90e25e0b 100644 --- a/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart +++ b/packages/google_maps_flutter/google_maps_flutter/lib/google_maps_flutter.dart @@ -56,6 +56,7 @@ export 'package:google_maps_flutter_platform_interface/google_maps_flutter_platf TileOverlay, TileOverlayId, TileProvider, + WebCameraControlPosition, WebGestureHandling, WeightedLatLng; diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart index 76bcad6e26c..4841a6197f4 100644 --- a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart @@ -95,6 +95,8 @@ class GoogleMap extends StatefulWidget { this.onMapCreated, this.gestureRecognizers = const >{}, 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 { /// 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, diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md index 1c723af8f61..4446dcb9abf 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.11.2 + +* Adds support to camera control button on web. + ## 2.11.1 * Updates READMEs and API docs. diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/map_configuration.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/map_configuration.dart index 6abd6c641e8..79ab513df85 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/map_configuration.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/map_configuration.dart @@ -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. + 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([ webGestureHandling, + webCameraControlPosition, + webCameraControlEnabled, compassEnabled, mapToolbarEnabled, cameraTargetBounds, diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/types.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/types.dart index 95c27d5bf95..effbeb825ab 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/types.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/types.dart @@ -44,4 +44,5 @@ export 'utils/marker.dart'; export 'utils/polygon.dart'; export 'utils/polyline.dart'; export 'utils/tile_overlay.dart'; +export 'web_camera_control_position.dart'; export 'web_gesture_handling.dart'; diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/web_camera_control_position.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/web_camera_control_position.dart new file mode 100644 index 00000000000..2f16bc8a632 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/web_camera_control_position.dart @@ -0,0 +1,143 @@ +// 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. + +/* +Logical values in LTR: + ++----------------+ +| BSIS BSIC BSIE | +| ISBS IEBS | +| | +| ISBC IEBC | +| | +| ISBE IEBE | +| BEIS BEIC BEIE | ++----------------+ + +Logical values in RTL: + ++----------------+ +| BSIE BSIC BSIS | +| IEBS ISBS | +| | +| IEBC ISBC | +| | +| IEBE ISBE | +| BEIE BEIC BEIS | ++----------------+ + +Legacy values: + ++----------------+ +| TL TC TR | +| LT RT | +| | +| LC RC | +| | +| LB RB | +| BL BC BR | ++----------------+ +*/ + +// 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, +} diff --git a/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md index 0fe686f03cd..dc218f09899 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.5.13 + +* Adds support to camera control button. + + ## 0.5.12 * Adds support for ground overlay. diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart index 0eeddbc8b84..c8d9a818a27 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart @@ -88,6 +88,16 @@ gmaps.MapOptions _configurationAndStyleToGmapsOptions( options.gestureHandling = WebGestureHandling.auto.name; } + if (configuration.webCameraControlEnabled != null) { + options.cameraControl = configuration.webCameraControlEnabled; + } + + if (configuration.webCameraControlPosition != null) { + options.cameraControlOptions = gmaps.CameraControlOptions( + position: _toControlPosition(configuration.webCameraControlPosition!), + ); + } + if (configuration.fortyFiveDegreeImageryEnabled != null) { options.rotateControl = configuration.fortyFiveDegreeImageryEnabled; } @@ -730,3 +740,59 @@ gmaps.LatLng _pixelToLatLng(gmaps.Map map, int x, int y) { return projection.fromPointToLatLng(point)!; } + +/// Converts a [WebCameraControlPosition] to [gmaps.ControlPosition]. +gmaps.ControlPosition _toControlPosition( + WebCameraControlPosition webCameraControlPosition, +) { + switch (webCameraControlPosition) { + case WebCameraControlPosition.blockEndInlineCenter: + return gmaps.ControlPosition.BLOCK_END_INLINE_CENTER; + case WebCameraControlPosition.blockEndInlineEnd: + return gmaps.ControlPosition.BLOCK_END_INLINE_END; + case WebCameraControlPosition.blockEndInlineStart: + return gmaps.ControlPosition.BLOCK_END_INLINE_START; + case WebCameraControlPosition.blockStartInlineCenter: + return gmaps.ControlPosition.BLOCK_START_INLINE_CENTER; + case WebCameraControlPosition.blockStartInlineEnd: + return gmaps.ControlPosition.BLOCK_START_INLINE_END; + case WebCameraControlPosition.blockStartInlineStart: + return gmaps.ControlPosition.BLOCK_START_INLINE_START; + case WebCameraControlPosition.bottomCenter: + return gmaps.ControlPosition.BOTTOM_CENTER; + case WebCameraControlPosition.bottomLeft: + return gmaps.ControlPosition.BOTTOM_LEFT; + case WebCameraControlPosition.bottomRight: + return gmaps.ControlPosition.BOTTOM_RIGHT; + case WebCameraControlPosition.inlineEndBlockCenter: + return gmaps.ControlPosition.INLINE_END_BLOCK_CENTER; + case WebCameraControlPosition.inlineEndBlockEnd: + return gmaps.ControlPosition.INLINE_END_BLOCK_END; + case WebCameraControlPosition.inlineEndBlockStart: + return gmaps.ControlPosition.INLINE_END_BLOCK_START; + case WebCameraControlPosition.inlineStartBlockCenter: + return gmaps.ControlPosition.INLINE_START_BLOCK_CENTER; + case WebCameraControlPosition.inlineStartBlockEnd: + return gmaps.ControlPosition.INLINE_START_BLOCK_END; + case WebCameraControlPosition.inlineStartBlockStart: + return gmaps.ControlPosition.INLINE_START_BLOCK_START; + case WebCameraControlPosition.leftBottom: + return gmaps.ControlPosition.LEFT_BOTTOM; + case WebCameraControlPosition.leftCenter: + return gmaps.ControlPosition.LEFT_CENTER; + case WebCameraControlPosition.leftTop: + return gmaps.ControlPosition.LEFT_TOP; + case WebCameraControlPosition.rightBottom: + return gmaps.ControlPosition.RIGHT_BOTTOM; + case WebCameraControlPosition.rightCenter: + return gmaps.ControlPosition.RIGHT_CENTER; + case WebCameraControlPosition.rightTop: + return gmaps.ControlPosition.RIGHT_TOP; + case WebCameraControlPosition.topCenter: + return gmaps.ControlPosition.TOP_CENTER; + case WebCameraControlPosition.topLeft: + return gmaps.ControlPosition.TOP_LEFT; + case WebCameraControlPosition.topRight: + return gmaps.ControlPosition.TOP_RIGHT; + } +} From 9281be8c1e5097dfe21f2f0f6dcb30d1223a2eb4 Mon Sep 17 00:00:00 2001 From: Arthur Monteiro Date: Tue, 15 Apr 2025 16:20:12 -0300 Subject: [PATCH 2/5] chore: update map_configuration_test.dart --- .../test/types/map_configuration_test.dart | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/map_configuration_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/map_configuration_test.dart index e34f32676e0..8e52b4b6082 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/map_configuration_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/map_configuration_test.dart @@ -12,6 +12,8 @@ void main() { group('diffs', () { // A options instance with every field set, to test diffs against. final MapConfiguration diffBase = MapConfiguration( + webCameraControlPosition: WebCameraControlPosition.topRight, + webCameraControlEnabled: false, webGestureHandling: WebGestureHandling.auto, compassEnabled: false, mapToolbarEnabled: false, @@ -59,6 +61,7 @@ void main() { expect(updated.padding, isNot(null)); expect(updated.trafficEnabled, isNot(null)); expect(updated.cloudMapId, null); + expect(updated.webCameraControlPosition, isNot(null)); }); test('handle webGestureHandling', () async { @@ -78,6 +81,42 @@ void main() { expect(empty.hashCode, isNot(diff.hashCode)); }); + test('handle webCameraControlPosition', () async { + const MapConfiguration diff = MapConfiguration( + webCameraControlPosition: WebCameraControlPosition.blockEndInlineEnd, + ); + + const MapConfiguration empty = MapConfiguration(); + final MapConfiguration updated = diffBase.applyDiff(diff); + + // A diff applied to empty options should be the diff itself. + expect(empty.applyDiff(diff), diff); + // The diff from empty options should be the diff itself. + expect(diff.diffFrom(empty), diff); + // A diff applied to non-empty options should update that field. + expect(updated.webCameraControlPosition, + WebCameraControlPosition.blockEndInlineEnd); + // The hash code should change. + expect(empty.hashCode, isNot(diff.hashCode)); + }); + + test('handle webCameraControlEnabled', () async { + const MapConfiguration diff = + MapConfiguration(webCameraControlEnabled: true); + + const MapConfiguration empty = MapConfiguration(); + final MapConfiguration updated = diffBase.applyDiff(diff); + + // A diff applied to empty options should be the diff itself. + expect(empty.applyDiff(diff), diff); + // The diff from empty options should be the diff itself. + expect(diff.diffFrom(empty), diff); + // A diff applied to non-empty options should update that field. + expect(updated.webCameraControlEnabled, true); + // The hash code should change. + expect(empty.hashCode, isNot(diff.hashCode)); + }); + test('handle compassEnabled', () async { const MapConfiguration diff = MapConfiguration(compassEnabled: true); @@ -435,6 +474,13 @@ void main() { expect(nullOptions.isEmpty, true); }); + test('is false with webCameraControlEnabled', () async { + const MapConfiguration diff = + MapConfiguration(webCameraControlEnabled: true); + + expect(diff.isEmpty, false); + }); + test('is false with compassEnabled', () async { const MapConfiguration diff = MapConfiguration(compassEnabled: true); From 25020bf6f84b6985f21fb99d94df0844c758b972 Mon Sep 17 00:00:00 2001 From: Arthur Monteiro Date: Tue, 15 Apr 2025 16:20:55 -0300 Subject: [PATCH 3/5] chore: add dependecy_overrides --- .../google_maps_flutter/example/pubspec.yaml | 7 +++++++ .../google_maps_flutter/google_maps_flutter/pubspec.yaml | 8 +++++++- .../google_maps_flutter_platform_interface/pubspec.yaml | 2 +- .../google_maps_flutter_web/pubspec.yaml | 8 +++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml index b686cbf766c..86cd2a9717f 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml @@ -21,6 +21,13 @@ dependencies: google_maps_flutter_android: ^2.16.0 google_maps_flutter_platform_interface: ^2.11.0 + +dependency_overrides: + google_maps_flutter_platform_interface: + path: ../../google_maps_flutter_platform_interface + google_maps_flutter_web: + path: ../../google_maps_flutter_web + dev_dependencies: build_runner: ^2.1.10 espresso: ^0.4.0 diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index 9a23a1d5253..2c611c2f6e9 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -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 +dependency_overrides: + google_maps_flutter_platform_interface: + path: ../google_maps_flutter_platform_interface + google_maps_flutter_web: + path: ../google_maps_flutter_web + dev_dependencies: flutter_test: sdk: flutter diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml index 0c376f4400f..e632f1e1750 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_maps_f issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.11.1 +version: 2.11.2 environment: sdk: ^3.4.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml index de53daa7817..5eea7c471e7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_web description: Web platform implementation of google_maps_flutter repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 0.5.12 +version: 0.5.13 environment: sdk: ^3.4.0 @@ -28,6 +28,12 @@ dependencies: stream_transform: ^2.0.0 web: ">=0.5.1 <2.0.0" +dependency_overrides: + google_maps_flutter_platform_interface: + path: ../google_maps_flutter_platform_interface + + + dev_dependencies: flutter_test: sdk: flutter From b2d1d89602adf87b30e79499a82b12bc0ab2cfc6 Mon Sep 17 00:00:00 2001 From: Arthur Monteiro Date: Mon, 21 Apr 2025 15:53:53 -0300 Subject: [PATCH 4/5] chore(step-1): make-deps-path-based --- .../google_maps_flutter/example/pubspec.yaml | 10 +++++----- .../google_maps_flutter/pubspec.yaml | 10 +++++----- .../google_maps_flutter_android/example/pubspec.yaml | 4 ++++ .../google_maps_flutter_android/pubspec.yaml | 4 ++++ .../google_maps_flutter_ios/example/ios14/pubspec.yaml | 4 ++++ .../google_maps_flutter_ios/example/ios15/pubspec.yaml | 4 ++++ .../example/shared/maps_example_dart/pubspec.yaml | 4 ++++ .../google_maps_flutter_ios/pubspec.yaml | 4 ++++ .../google_maps_flutter_web/example/pubspec.yaml | 9 ++++----- .../google_maps_flutter_web/pubspec.yaml | 5 +++-- 10 files changed, 41 insertions(+), 17 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml index 86cd2a9717f..a294973621b 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml @@ -22,11 +22,11 @@ dependencies: google_maps_flutter_platform_interface: ^2.11.0 -dependency_overrides: - google_maps_flutter_platform_interface: - path: ../../google_maps_flutter_platform_interface - google_maps_flutter_web: - path: ../../google_maps_flutter_web +# 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: build_runner: ^2.1.10 diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index 2c611c2f6e9..a3cf30c2b85 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -26,11 +26,11 @@ dependencies: google_maps_flutter_platform_interface: ^2.11.0 google_maps_flutter_web: ^0.5.12 -dependency_overrides: - google_maps_flutter_platform_interface: - path: ../google_maps_flutter_platform_interface - google_maps_flutter_web: - path: ../google_maps_flutter_web +# 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: diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml index 4acca270819..6474773e083 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml @@ -33,3 +33,7 @@ flutter: uses-material-design: true assets: - assets/ +# 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} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index 84779722eb1..2b836ab5576 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -37,3 +37,7 @@ topics: - google-maps - google-maps-flutter - map +# 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} diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml index 947a78b4241..856ec01cb77 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml @@ -32,3 +32,7 @@ flutter: uses-material-design: true assets: - assets/ +# 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} diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml index 947a78b4241..856ec01cb77 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml @@ -32,3 +32,7 @@ flutter: uses-material-design: true assets: - assets/ +# 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} diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml index 071506ac425..202348d7ca4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml @@ -27,3 +27,7 @@ dev_dependencies: flutter: uses-material-design: true +# 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} diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml index 55c040865da..8b3bc5d8f5c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml @@ -35,3 +35,7 @@ topics: - google-maps - google-maps-flutter - map +# 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} diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_web/example/pubspec.yaml index a61f8043548..2f3724e441d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/pubspec.yaml @@ -28,9 +28,8 @@ flutter: assets: - assets/ +# 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: - # Override the google_maps_flutter dependency on google_maps_flutter_web. - # TODO(ditman): Unwind the circular dependency. This will create problems - # if we need to make a breaking change to google_maps_flutter_web. - google_maps_flutter_web: - path: ../ + google_maps_flutter_platform_interface: {path: ../../../../packages/google_maps_flutter/google_maps_flutter_platform_interface} + google_maps_flutter_web: {path: ../} diff --git a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml index 5eea7c471e7..e123d4933e6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml @@ -28,9 +28,10 @@ dependencies: stream_transform: ^2.0.0 web: ">=0.5.1 <2.0.0" +# 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: ../google_maps_flutter_platform_interface + google_maps_flutter_platform_interface: {path: ../../../packages/google_maps_flutter/google_maps_flutter_platform_interface} From a5a5ff597177cbbf3343b8ea9a9e04d15b4e9d19 Mon Sep 17 00:00:00 2001 From: Arthur Monteiro Date: Mon, 21 Apr 2025 16:14:00 -0300 Subject: [PATCH 5/5] chore(changelog): merge with upstream --- .../google_maps_flutter/google_maps_flutter/CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index 2b86f43de2e..038c564c099 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,10 +1,10 @@ ## NEXT -* Adds support for camera control button on web. +* Updates README to indicate that Andoid SDK <21 is no longer supported. -## NEXT +## 2.12.2 -* Updates README to indicate that Andoid SDK <21 is no longer supported. +* Adds support for camera control button on web. ## 2.12.1