Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 4 additions & 10 deletions packages/google_maps_flutter/google_maps_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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()));
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is it necessary to deprecate a private constructor.

Copy link
Contributor Author

@stuartmorgan-g stuartmorgan-g Sep 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise we get https://dart-lang.github.io/linter/lints/deprecated_consistency.html. At first I thought it was a bug, but then I realized that we're using deprecated_member_use_from_same_package: ignore in Flutter repos, and without that it would make sense because other code in the library that referenced the private constructor should get a warning.

'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.
Expand All @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down