diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index f0c5c78a2e..a0b461f10e 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.3.0 + +* Endorses [`google_maps_flutter_web`](https://pub.dev/packages/google_maps_flutter_web) + as the web implementation of this plugin. + ## 2.2.8 * Fixes unawaited_futures violations. diff --git a/packages/google_maps_flutter/google_maps_flutter/README.md b/packages/google_maps_flutter/google_maps_flutter/README.md index ea15dfc1f7..b495d0efce 100644 --- a/packages/google_maps_flutter/google_maps_flutter/README.md +++ b/packages/google_maps_flutter/google_maps_flutter/README.md @@ -6,9 +6,11 @@ A Flutter plugin that provides a [Google Maps](https://developers.google.com/maps/) widget. -| | Android | iOS | -|-------------|---------|---------| -| **Support** | SDK 20+ | iOS 11+ | +| | Android | iOS | Web | +|-------------|---------|---------|----------------------------------| +| **Support** | SDK 20+ | iOS 11+ | Same as [Flutter's][web-support] | + +[web-support]: https://docs.flutter.dev/reference/supported-platforms ## Usage @@ -25,6 +27,7 @@ To use this plugin, add `google_maps_flutter` as a [dependency in your pubspec.y * Select "APIs" under the Google Maps menu. * To enable Google Maps for Android, select "Maps SDK for Android" in the "Additional APIs" section, then select "ENABLE". * To enable Google Maps for iOS, select "Maps SDK for iOS" in the "Additional APIs" section, then select "ENABLE". + * To enable Google Maps for Web, enable the "Maps JavaScript API". * Make sure the APIs you enabled are under the "Enabled APIs" section. For more details, see [Getting started with Google Maps Platform](https://developers.google.com/maps/gmp-get-started). @@ -98,7 +101,16 @@ import GoogleMaps } ``` -### Both +### Web + +You'll need to modify the `web/index.html` file of your Flutter Web application +to include the Google Maps JS SDK. + +Check [the `google_maps_flutter_web` README](https://pub.dev/packages/google_maps_flutter_web) +for the latest information on how to prepare your App to use Google Maps on the +web. + +### All You can now add a `GoogleMap` widget to your widget tree. diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/favicon.png b/packages/google_maps_flutter/google_maps_flutter/example/web/favicon.png new file mode 100644 index 0000000000..8aaa46ac1a Binary files /dev/null and b/packages/google_maps_flutter/google_maps_flutter/example/web/favicon.png differ diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-192.png b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-192.png new file mode 100644 index 0000000000..b749bfef07 Binary files /dev/null and b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-192.png differ diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-512.png b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-512.png new file mode 100644 index 0000000000..88cfd48dff Binary files /dev/null and b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-512.png differ diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-maskable-192.png b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000000..eb9b4d76e5 Binary files /dev/null and b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-maskable-192.png differ diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-maskable-512.png b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000000..d69c56691f Binary files /dev/null and b/packages/google_maps_flutter/google_maps_flutter/example/web/icons/Icon-maskable-512.png differ diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/index.html b/packages/google_maps_flutter/google_maps_flutter/example/web/index.html new file mode 100644 index 0000000000..58522ba720 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter/example/web/index.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + Google Maps Web Example + + + + + + + + + + + + + + diff --git a/packages/google_maps_flutter/google_maps_flutter/example/web/manifest.json b/packages/google_maps_flutter/google_maps_flutter/example/web/manifest.json new file mode 100644 index 0000000000..096edf8fe4 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter/example/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "example", + "short_name": "example", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index b76ea7b28c..d1e577027b 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.2.8 +version: 2.3.0 environment: sdk: ">=2.18.0 <4.0.0" @@ -15,6 +15,8 @@ flutter: default_package: google_maps_flutter_android ios: default_package: google_maps_flutter_ios + web: + default_package: google_maps_flutter_web dependencies: flutter: @@ -22,9 +24,14 @@ dependencies: google_maps_flutter_android: ^2.1.10 google_maps_flutter_ios: ^2.1.10 google_maps_flutter_platform_interface: ^2.2.1 + google_maps_flutter_web: ^0.5.0 dev_dependencies: flutter_test: sdk: flutter plugin_platform_interface: ^2.0.0 stream_transform: ^2.0.0 + +# The example deliberately includes limited-use secrets. +false_secrets: + - /example/web/index.html diff --git a/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md index e5ce58486c..4f9eed77d6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.5.0+1 + +* Updates the README to mention that this package is the endorsed implementation + of `google_maps_flutter` for the web platform. + ## 0.5.0 * **BREAKING CHANGE:** Fires a `MapStyleException` when an invalid JSON is used diff --git a/packages/google_maps_flutter/google_maps_flutter_web/README.md b/packages/google_maps_flutter/google_maps_flutter_web/README.md index 6c61c5d44f..b52da95119 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/README.md +++ b/packages/google_maps_flutter/google_maps_flutter_web/README.md @@ -1,15 +1,18 @@ # google_maps_flutter_web -This is an implementation of the [google_maps_flutter](https://pub.dev/packages/google_maps_flutter) plugin for web. Behind the scenes, it uses a14n's [google_maps](https://pub.dev/packages/google_maps) dart JS interop layer. +The web implementation of [google_maps_flutter](https://pub.dev/packages/google_maps_flutter). + +Powered by [a14n](https://github.com/a14n)'s [google_maps](https://pub.dev/packages/google_maps) Dart JS interop layer. ## Usage -### Depend on the package +This package is [endorsed](https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin), +which means you can simply use `google_maps_flutter` normally. This package will +be automatically included in your app when you do, so you do not need to add it +to your `pubspec.yaml`. -This package is not an endorsed implementation of the google_maps_flutter plugin yet, so you'll need to -[add it explicitly](https://pub.dev/packages/google_maps_flutter_web/install). - -Once you do, you can use the `google_maps_flutter` APIs as you normally would. +However, if you `import` this package to use any of its APIs directly, you +should add it to your `pubspec.yaml` as usual. ### Modify web/index.html @@ -26,6 +29,25 @@ Modify the `` tag of your `web/index.html` to load the Google Maps JavaScr ``` +The Google Maps Web SDK splits some of its functionality in [separate libraries](https://developers.google.com/maps/documentation/javascript/libraries#libraries-for-dynamic-library-import). + +If your app needs the `drawing` library (to draw polygons, rectangles, polylines, +circles or markers on a map), include it like this: + +```html + +``` + +To request multiple libraries, separate them with commas: + +```html + +``` + Now you should be able to use the Google Maps plugin normally. ## Limitations of the web version diff --git a/packages/google_maps_flutter/google_maps_flutter_web/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_web/example/pubspec.yaml index fb4c691d2f..60c6b72809 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/example/pubspec.yaml @@ -20,8 +20,7 @@ dev_dependencies: flutter_test: sdk: flutter google_maps: ^6.1.0 - google_maps_flutter: # Used for projection_test.dart - path: ../../google_maps_flutter + google_maps_flutter: ^2.2.0 # Needed for projection_test.dart http: ^1.0.0 integration_test: sdk: flutter diff --git a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml index c72d96eeaa..9372beb0c8 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_web description: Web platform implementation of google_maps_flutter repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 0.5.0 +version: 0.5.0+1 environment: sdk: ">=2.18.0 <4.0.0"