From 27fc437ba61d4e9edf3edbd146cadedc41b2be71 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 29 Aug 2022 16:33:42 -0400 Subject: [PATCH] Update app-facing package --- .../google_maps_flutter/CHANGELOG.md | 4 ++++ .../google_maps_flutter/README.md | 14 ++++---------- .../google_maps_flutter/example/lib/main.dart | 10 ++++++---- .../google_maps_flutter/example/pubspec.yaml | 2 ++ .../google_maps_flutter/lib/src/google_map.dart | 15 ++++++++------- .../google_maps_flutter/pubspec.yaml | 2 +- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index e1f963b8e732..52c5c01aaa0a 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.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). ## 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 196f054e1fc0..9b24c14c4868 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 f632e374351b..8bc61bd5abf3 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"