diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index be73df702d76..291ba6230a60 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,5 +1,7 @@ -## NEXT +## 2.2.0 +* Deprecates `AndroidGoogleMapsFlutter.useAndroidViewSurface` in favor of + [setting the flag directly in the Android implementation](https://pub.dev/packages/google_maps_flutter_android#display-mode). * Updates minimum Flutter version to 2.10. ## 2.1.12 diff --git a/packages/google_maps_flutter/google_maps_flutter/README.md b/packages/google_maps_flutter/google_maps_flutter/README.md index ae9a659c715f..58726a1faaa1 100644 --- a/packages/google_maps_flutter/google_maps_flutter/README.md +++ b/packages/google_maps_flutter/google_maps_flutter/README.md @@ -50,17 +50,11 @@ This means that app will only be available for users that run Android SDK 20 or android:value="YOUR KEY HERE"/> ``` -#### Hybrid Composition +#### Display Mode -To use [Hybrid Composition](https://flutter.dev/docs/development/platform-integration/platform-views) -to render the `GoogleMap` widget on Android, set `AndroidGoogleMapsFlutter.useAndroidViewSurface` to -true. - -```dart -if (defaultTargetPlatform == TargetPlatform.android) { - AndroidGoogleMapsFlutter.useAndroidViewSurface = true; -} -``` +The Android implementation supports multiple +[platform view display modes](https://flutter.dev/docs/development/platform-integration/platform-views). +For details, see [the Android README](https://pub.dev/packages/google_maps_flutter_android#display-mode). ### iOS diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart index 8932705bc6d5..b11f29977f23 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_flutter_android/google_maps_flutter_android.dart'; import 'package:google_maps_flutter_example/lite_mode.dart'; +import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; import 'animate_camera.dart'; import 'map_click.dart'; import 'map_coordinates.dart'; @@ -71,8 +71,10 @@ class MapsDemo extends StatelessWidget { } void main() { - if (defaultTargetPlatform == TargetPlatform.android) { - AndroidGoogleMapsFlutter.useAndroidViewSurface = true; + final GoogleMapsFlutterPlatform mapsImplementation = + GoogleMapsFlutterPlatform.instance; + if (mapsImplementation is GoogleMapsFlutterAndroid) { + mapsImplementation.useAndroidViewSurface = true; } runApp(const MaterialApp(home: MapsDemo())); } 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 6736fce066b2..77e9b9497410 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml @@ -18,6 +18,8 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ + google_maps_flutter_android: ^2.1.10 + google_maps_flutter_platform_interface: ^2.2.1 dev_dependencies: espresso: ^0.1.0+2 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 6bb5e75f91ec..1f7871068cab 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 @@ -40,10 +40,11 @@ class UnknownMapObjectIdError extends Error { } /// Android specific settings for [GoogleMap]. -// TODO(stuartmorgan): Deprecate this in favor of pointing people who want to -// change this to using the Android implementation Dart class directly. This -// should be done as part of switching the default to hybrid composition. +@Deprecated( + 'See https://pub.dev/packages/google_maps_flutter_android#display-mode') class AndroidGoogleMapsFlutter { + @Deprecated( + 'See https://pub.dev/packages/google_maps_flutter_android#display-mode') AndroidGoogleMapsFlutter._(); /// Whether to render [GoogleMap] with a [AndroidViewSurface] to build the Google Maps widget. @@ -53,8 +54,8 @@ class AndroidGoogleMapsFlutter { /// versions below 10. See /// https://flutter.dev/docs/development/platform-integration/platform-views#performance for more /// information. - /// - /// Defaults to false. + @Deprecated( + 'See https://pub.dev/packages/google_maps_flutter_android#display-mode') static bool get useAndroidViewSurface { final GoogleMapsFlutterPlatform platform = GoogleMapsFlutterPlatform.instance; @@ -71,8 +72,8 @@ class AndroidGoogleMapsFlutter { /// versions below 10. See /// https://flutter.dev/docs/development/platform-integration/platform-views#performance for more /// information. - /// - /// Defaults to false. + @Deprecated( + 'See https://pub.dev/packages/google_maps_flutter_android#display-mode') static set useAndroidViewSurface(bool useAndroidViewSurface) { final GoogleMapsFlutterPlatform platform = GoogleMapsFlutterPlatform.instance; diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index 95c4e98c1dd0..dd8c82d4d4e5 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/plugins/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.1.12 +version: 2.2.0 environment: sdk: ">=2.14.0 <3.0.0"