diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index 3dcd5bd12f93..056b3ffd66ba 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.18.0 + +* Adds support for mapTypeControlEnabled, fullscreenControlEnabled, and streetViewControlEnabled on web. + ## 2.17.1 * Updates README to link to implementation packages for platform-specific 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 6bd36da0ee9a..9481704ea85f 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: # the parent directory to use the current plugin's version. path: ../ google_maps_flutter_android: ^2.19.1 - google_maps_flutter_platform_interface: ^2.14.2 + google_maps_flutter_platform_interface: ^2.16.0 dev_dependencies: build_runner: ^2.1.10 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 3bd76b784571..d90b7aa175b4 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 @@ -103,6 +103,9 @@ class GoogleMap extends StatefulWidget { this.webCameraControlEnabled = true, this.compassEnabled = true, this.mapToolbarEnabled = true, + this.mapTypeControlEnabled = false, + this.fullscreenControlEnabled = false, + this.streetViewControlEnabled = false, this.cameraTargetBounds = CameraTargetBounds.unbounded, this.mapType = MapType.normal, this.minMaxZoomPreference = MinMaxZoomPreference.unbounded, @@ -374,6 +377,21 @@ class GoogleMap extends StatefulWidget { /// See https://developers.google.com/maps/documentation/javascript/controls for more details. final bool webCameraControlEnabled; + /// True if map type control should be shown. + /// + /// Web only. + final bool mapTypeControlEnabled; + + /// True if fullscreen control should be shown. + /// + /// Web only. + final bool fullscreenControlEnabled; + + /// True if street view control should be shown. + /// + /// Web only. + final bool streetViewControlEnabled; + /// Identifier that's associated with a specific cloud-based map style. /// /// See https://developers.google.com/maps/documentation/get-map-id @@ -724,6 +742,9 @@ MapConfiguration _configurationFromMapWidget(GoogleMap map) { webGestureHandling: map.webGestureHandling, compassEnabled: map.compassEnabled, mapToolbarEnabled: map.mapToolbarEnabled, + mapTypeControlEnabled: map.mapTypeControlEnabled, + fullscreenControlEnabled: map.fullscreenControlEnabled, + streetViewControlEnabled: map.streetViewControlEnabled, cameraTargetBounds: map.cameraTargetBounds, mapType: map.mapType, minMaxZoomPreference: map.minMaxZoomPreference, diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index 0342292634b8..d7737ac9e945 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.17.1 +version: 2.18.0 environment: sdk: ^3.10.0 @@ -23,8 +23,8 @@ dependencies: sdk: flutter google_maps_flutter_android: ^2.19.1 google_maps_flutter_ios: ^2.18.0 - google_maps_flutter_platform_interface: ^2.15.0 - google_maps_flutter_web: ^0.6.2 + google_maps_flutter_platform_interface: ^2.16.0 + google_maps_flutter_web: ^0.6.3 dev_dependencies: flutter_test: diff --git a/packages/google_maps_flutter/google_maps_flutter/test/google_map_test.dart b/packages/google_maps_flutter/google_maps_flutter/test/google_map_test.dart index 722a4390bb65..e284ed1d87e7 100644 --- a/packages/google_maps_flutter/google_maps_flutter/test/google_map_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter/test/google_map_test.dart @@ -108,6 +108,81 @@ void main() { expect(map.mapConfiguration.mapToolbarEnabled, true); }); + testWidgets('Can update mapTypeControlEnabled', (WidgetTester tester) async { + await tester.pumpWidget( + const Directionality( + textDirection: TextDirection.ltr, + child: GoogleMap( + initialCameraPosition: CameraPosition(target: LatLng(10.0, 15.0)), + mapTypeControlEnabled: true, + ), + ), + ); + + final PlatformMapStateRecorder map = platform.lastCreatedMap; + + expect(map.mapConfiguration.mapTypeControlEnabled, true); + + await tester.pumpWidget( + const Directionality( + textDirection: TextDirection.ltr, + child: GoogleMap(initialCameraPosition: CameraPosition(target: LatLng(10.0, 15.0))), + ), + ); + + expect(map.mapConfiguration.mapTypeControlEnabled, false); + }); + + testWidgets('Can update fullscreenControlEnabled', (WidgetTester tester) async { + await tester.pumpWidget( + const Directionality( + textDirection: TextDirection.ltr, + child: GoogleMap( + initialCameraPosition: CameraPosition(target: LatLng(10.0, 15.0)), + fullscreenControlEnabled: true, + ), + ), + ); + + final PlatformMapStateRecorder map = platform.lastCreatedMap; + + expect(map.mapConfiguration.fullscreenControlEnabled, true); + + await tester.pumpWidget( + const Directionality( + textDirection: TextDirection.ltr, + child: GoogleMap(initialCameraPosition: CameraPosition(target: LatLng(10.0, 15.0))), + ), + ); + + expect(map.mapConfiguration.fullscreenControlEnabled, false); + }); + + testWidgets('Can update streetViewControlEnabled', (WidgetTester tester) async { + await tester.pumpWidget( + const Directionality( + textDirection: TextDirection.ltr, + child: GoogleMap( + initialCameraPosition: CameraPosition(target: LatLng(10.0, 15.0)), + streetViewControlEnabled: true, + ), + ), + ); + + final PlatformMapStateRecorder map = platform.lastCreatedMap; + + expect(map.mapConfiguration.streetViewControlEnabled, true); + + await tester.pumpWidget( + const Directionality( + textDirection: TextDirection.ltr, + child: GoogleMap(initialCameraPosition: CameraPosition(target: LatLng(10.0, 15.0))), + ), + ); + + expect(map.mapConfiguration.streetViewControlEnabled, false); + }); + testWidgets('Can update cameraTargetBounds', (WidgetTester tester) async { await tester.pumpWidget( Directionality(