Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 8b70ec8

Browse files
[google_maps_flutter] Deprecate AndroidGoogleMapsFlutter (#6335)
1 parent 6d1d1ce commit 8b70ec8

File tree

6 files changed

+24
-23
lines changed

6 files changed

+24
-23
lines changed

packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
## NEXT
1+
## 2.2.0
22

3+
* Deprecates `AndroidGoogleMapsFlutter.useAndroidViewSurface` in favor of
4+
[setting the flag directly in the Android implementation](https://pub.dev/packages/google_maps_flutter_android#display-mode).
35
* Updates minimum Flutter version to 2.10.
46

57
## 2.1.12

packages/google_maps_flutter/google_maps_flutter/README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,11 @@ This means that app will only be available for users that run Android SDK 20 or
5050
android:value="YOUR KEY HERE"/>
5151
```
5252

53-
#### Hybrid Composition
53+
#### Display Mode
5454

55-
To use [Hybrid Composition](https://flutter.dev/docs/development/platform-integration/platform-views)
56-
to render the `GoogleMap` widget on Android, set `AndroidGoogleMapsFlutter.useAndroidViewSurface` to
57-
true.
58-
59-
```dart
60-
if (defaultTargetPlatform == TargetPlatform.android) {
61-
AndroidGoogleMapsFlutter.useAndroidViewSurface = true;
62-
}
63-
```
55+
The Android implementation supports multiple
56+
[platform view display modes](https://flutter.dev/docs/development/platform-integration/platform-views).
57+
For details, see [the Android README](https://pub.dev/packages/google_maps_flutter_android#display-mode).
6458

6559
### iOS
6660

packages/google_maps_flutter/google_maps_flutter/example/lib/main.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'package:flutter/foundation.dart';
65
import 'package:flutter/material.dart';
76

8-
import 'package:google_maps_flutter/google_maps_flutter.dart';
7+
import 'package:google_maps_flutter_android/google_maps_flutter_android.dart';
98
import 'package:google_maps_flutter_example/lite_mode.dart';
9+
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
1010
import 'animate_camera.dart';
1111
import 'map_click.dart';
1212
import 'map_coordinates.dart';
@@ -71,8 +71,10 @@ class MapsDemo extends StatelessWidget {
7171
}
7272

7373
void main() {
74-
if (defaultTargetPlatform == TargetPlatform.android) {
75-
AndroidGoogleMapsFlutter.useAndroidViewSurface = true;
74+
final GoogleMapsFlutterPlatform mapsImplementation =
75+
GoogleMapsFlutterPlatform.instance;
76+
if (mapsImplementation is GoogleMapsFlutterAndroid) {
77+
mapsImplementation.useAndroidViewSurface = true;
7678
}
7779
runApp(const MaterialApp(home: MapsDemo()));
7880
}

packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ dependencies:
1818
# The example app is bundled with the plugin so we use a path dependency on
1919
# the parent directory to use the current plugin's version.
2020
path: ../
21+
google_maps_flutter_android: ^2.1.10
22+
google_maps_flutter_platform_interface: ^2.2.1
2123

2224
dev_dependencies:
2325
espresso: ^0.1.0+2

packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ class UnknownMapObjectIdError extends Error {
4040
}
4141

4242
/// Android specific settings for [GoogleMap].
43-
// TODO(stuartmorgan): Deprecate this in favor of pointing people who want to
44-
// change this to using the Android implementation Dart class directly. This
45-
// should be done as part of switching the default to hybrid composition.
43+
@Deprecated(
44+
'See https://pub.dev/packages/google_maps_flutter_android#display-mode')
4645
class AndroidGoogleMapsFlutter {
46+
@Deprecated(
47+
'See https://pub.dev/packages/google_maps_flutter_android#display-mode')
4748
AndroidGoogleMapsFlutter._();
4849

4950
/// Whether to render [GoogleMap] with a [AndroidViewSurface] to build the Google Maps widget.
@@ -53,8 +54,8 @@ class AndroidGoogleMapsFlutter {
5354
/// versions below 10. See
5455
/// https://flutter.dev/docs/development/platform-integration/platform-views#performance for more
5556
/// information.
56-
///
57-
/// Defaults to false.
57+
@Deprecated(
58+
'See https://pub.dev/packages/google_maps_flutter_android#display-mode')
5859
static bool get useAndroidViewSurface {
5960
final GoogleMapsFlutterPlatform platform =
6061
GoogleMapsFlutterPlatform.instance;
@@ -71,8 +72,8 @@ class AndroidGoogleMapsFlutter {
7172
/// versions below 10. See
7273
/// https://flutter.dev/docs/development/platform-integration/platform-views#performance for more
7374
/// information.
74-
///
75-
/// Defaults to false.
75+
@Deprecated(
76+
'See https://pub.dev/packages/google_maps_flutter_android#display-mode')
7677
static set useAndroidViewSurface(bool useAndroidViewSurface) {
7778
final GoogleMapsFlutterPlatform platform =
7879
GoogleMapsFlutterPlatform.instance;

packages/google_maps_flutter/google_maps_flutter/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_maps_flutter
22
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
33
repository: https://github.com/flutter/plugins/tree/main/packages/google_maps_flutter/google_maps_flutter
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
5-
version: 2.1.12
5+
version: 2.2.0
66

77
environment:
88
sdk: ">=2.14.0 <3.0.0"

0 commit comments

Comments
 (0)