From 25c8812291b65e5e6ca0107fbd0b7b6611b610ec Mon Sep 17 00:00:00 2001 From: DEVSOG12 Date: Thu, 8 Dec 2022 20:21:51 -0500 Subject: [PATCH 1/5] Refactored Reaadme using code excerpts --- .../google_maps_flutter/CHANGELOG.md | 4 ++ .../google_maps_flutter/README.md | 36 ++++------ .../example/build.excerpt.yaml | 15 ++++ .../example/lib/readme_sample.dart | 72 +++++++++++++++++++ .../google_maps_flutter/pubspec.yaml | 2 +- 5 files changed, 104 insertions(+), 25 deletions(-) create mode 100644 packages/google_maps_flutter/google_maps_flutter/example/build.excerpt.yaml create mode 100644 packages/google_maps_flutter/google_maps_flutter/example/lib/readme_sample.dart diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index 4d0164603c42..35e9f75fa96f 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -3,6 +3,10 @@ * Updates code for new analysis options. * Updates code for `no_leading_underscores_for_local_identifiers` lint. +## 2.2.2 + +* Modified `README.md` to fix minor syntax issues and added Code Excerpt to `README.md`. + ## 2.2.1 * Updates imports for `prefer_relative_imports`. diff --git a/packages/google_maps_flutter/google_maps_flutter/README.md b/packages/google_maps_flutter/google_maps_flutter/README.md index 58726a1faaa1..b3e3d9bc8333 100644 --- a/packages/google_maps_flutter/google_maps_flutter/README.md +++ b/packages/google_maps_flutter/google_maps_flutter/README.md @@ -1,5 +1,7 @@ # Google Maps for Flutter + + [![pub package](https://img.shields.io/pub/v/google_maps_flutter.svg)](https://pub.dev/packages/google_maps_flutter) A Flutter plugin that provides a [Google Maps](https://developers.google.com/maps/) widget. @@ -105,38 +107,25 @@ the `GoogleMap`'s `onMapCreated` callback. ### Sample Usage + ```dart -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -void main() => runApp(MyApp()); - -class MyApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Google Maps Demo', - home: MapSample(), - ); - } -} - class MapSample extends StatefulWidget { + const MapSample({Key? key}) : super(key: key); + @override State createState() => MapSampleState(); } class MapSampleState extends State { - Completer _controller = Completer(); + final Completer _controller = + Completer(); - static final CameraPosition _kGooglePlex = CameraPosition( + static const CameraPosition _kGooglePlex = CameraPosition( target: LatLng(37.42796133580664, -122.085749655962), zoom: 14.4746, ); - static final CameraPosition _kLake = CameraPosition( + static const CameraPosition _kLake = CameraPosition( bearing: 192.8334901395799, target: LatLng(37.43296265331129, -122.08832357078792), tilt: 59.440717697143555, @@ -144,7 +133,7 @@ class MapSampleState extends State { @override Widget build(BuildContext context) { - return new Scaffold( + return Scaffold( body: GoogleMap( mapType: MapType.hybrid, initialCameraPosition: _kGooglePlex, @@ -154,8 +143,8 @@ class MapSampleState extends State { ), floatingActionButton: FloatingActionButton.extended( onPressed: _goToTheLake, - label: Text('To the lake!'), - icon: Icon(Icons.directions_boat), + label: const Text('To the lake!'), + icon: const Icon(Icons.directions_boat), ), ); } @@ -164,7 +153,6 @@ class MapSampleState extends State { final GoogleMapController controller = await _controller.future; controller.animateCamera(CameraUpdate.newCameraPosition(_kLake)); } -} ``` See the `example` directory for a complete sample app. diff --git a/packages/google_maps_flutter/google_maps_flutter/example/build.excerpt.yaml b/packages/google_maps_flutter/google_maps_flutter/example/build.excerpt.yaml new file mode 100644 index 000000000000..46c1e754361f --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter/example/build.excerpt.yaml @@ -0,0 +1,15 @@ +targets: + $default: + sources: + include: + - lib/** + # Some default includes that aren't really used here but will prevent + # false-negative warnings: + - $package$ + - lib/$lib$ + exclude: + - '**/.*/**' + - '**/build/**' + builders: + code_excerpter|code_excerpter: + enabled: true \ No newline at end of file diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/readme_sample.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/readme_sample.dart new file mode 100644 index 000000000000..a15639893515 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/readme_sample.dart @@ -0,0 +1,72 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// ignore_for_file: public_member_api_docs + +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +void main() => runApp(const MyApp()); + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return const MaterialApp( + title: 'Flutter Google Maps Demo', + home: MapSample(), + ); + } +} + +// #docregion MapSample +class MapSample extends StatefulWidget { + const MapSample({Key? key}) : super(key: key); + + @override + State createState() => MapSampleState(); +} + +class MapSampleState extends State { + final Completer _controller = + Completer(); + + static const CameraPosition _kGooglePlex = CameraPosition( + target: LatLng(37.42796133580664, -122.085749655962), + zoom: 14.4746, + ); + + static const CameraPosition _kLake = CameraPosition( + bearing: 192.8334901395799, + target: LatLng(37.43296265331129, -122.08832357078792), + tilt: 59.440717697143555, + zoom: 19.151926040649414); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: GoogleMap( + mapType: MapType.hybrid, + initialCameraPosition: _kGooglePlex, + onMapCreated: (GoogleMapController controller) { + _controller.complete(controller); + }, + ), + floatingActionButton: FloatingActionButton.extended( + onPressed: _goToTheLake, + label: const Text('To the lake!'), + icon: const Icon(Icons.directions_boat), + ), + ); + } + + Future _goToTheLake() async { + final GoogleMapController controller = await _controller.future; + controller.animateCamera(CameraUpdate.newCameraPosition(_kLake)); + } + // #enddocregion MapSample +} diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index 540f5d810966..a037f614f2ac 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.2.1 +version: 2.2.2 environment: sdk: ">=2.14.0 <3.0.0" From 3c116d94a4d7a40c68d909367a2aa7722dc2452e Mon Sep 17 00:00:00 2001 From: DEVSOG12 Date: Sat, 10 Dec 2022 22:29:51 -0500 Subject: [PATCH 2/5] Fixes --- .../google_maps_flutter/google_maps_flutter/CHANGELOG.md | 5 ----- .../google_maps_flutter/example/build.excerpt.yaml | 8 ++++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index 35e9f75fa96f..cebd90c74d9e 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,8 +1,3 @@ -## NEXT - -* Updates code for new analysis options. -* Updates code for `no_leading_underscores_for_local_identifiers` lint. - ## 2.2.2 * Modified `README.md` to fix minor syntax issues and added Code Excerpt to `README.md`. diff --git a/packages/google_maps_flutter/google_maps_flutter/example/build.excerpt.yaml b/packages/google_maps_flutter/google_maps_flutter/example/build.excerpt.yaml index 46c1e754361f..2102d25a193c 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/build.excerpt.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/example/build.excerpt.yaml @@ -9,7 +9,7 @@ targets: - lib/$lib$ exclude: - '**/.*/**' - - '**/build/**' - builders: - code_excerpter|code_excerpter: - enabled: true \ No newline at end of file + # - '**/build/**' + # builders: + # code_excerpter|code_excerpter: + # enabled: true \ No newline at end of file From 03715f4c6def1fb78b85d771e32c26d86100106c Mon Sep 17 00:00:00 2001 From: DEVSOG12 Date: Sat, 10 Dec 2022 22:43:17 -0500 Subject: [PATCH 3/5] Updated Upstream and Fixed Test Errors --- .../google_maps_flutter/example/pubspec.yaml | 1 + script/configs/temp_exclude_excerpt.yaml | 23 ------------------- 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 script/configs/temp_exclude_excerpt.yaml 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 ce6819c190db..06bfbbf290e4 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml @@ -22,6 +22,7 @@ dependencies: google_maps_flutter_platform_interface: ^2.2.1 dev_dependencies: + build_runner: ^2.1.10 espresso: ^0.2.0 flutter_driver: sdk: flutter diff --git a/script/configs/temp_exclude_excerpt.yaml b/script/configs/temp_exclude_excerpt.yaml deleted file mode 100644 index c59983efd058..000000000000 --- a/script/configs/temp_exclude_excerpt.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Packages that have not yet adopted code-excerpt. -# -# This only exists to allow incrementally adopting the new requirement. -# Packages shoud never be added to this list. - -# TODO(ecosystem): Remove everything from this list. See -# https://github.com/flutter/flutter/issues/102679 -- camera_web -- espresso -- google_maps_flutter/google_maps_flutter -- google_sign_in/google_sign_in -- google_sign_in_web -- image_picker/image_picker -- image_picker_for_web -- in_app_purchase/in_app_purchase -- ios_platform_images -- path_provider/path_provider -- plugin_platform_interface -- quick_actions/quick_actions -- shared_preferences/shared_preferences -- webview_flutter/webview_flutter -- webview_flutter_android -- webview_flutter_web From 7c3c1b69e4d5efefcf14dfc0e23c62af16d7e270 Mon Sep 17 00:00:00 2001 From: DEVSOG12 Date: Sat, 10 Dec 2022 22:51:24 -0500 Subject: [PATCH 4/5] Re-added temp_exclude_excerpt.yaml back due to Failing Test --- script/configs/temp_exclude_excerpt.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 script/configs/temp_exclude_excerpt.yaml diff --git a/script/configs/temp_exclude_excerpt.yaml b/script/configs/temp_exclude_excerpt.yaml new file mode 100644 index 000000000000..c59983efd058 --- /dev/null +++ b/script/configs/temp_exclude_excerpt.yaml @@ -0,0 +1,23 @@ +# Packages that have not yet adopted code-excerpt. +# +# This only exists to allow incrementally adopting the new requirement. +# Packages shoud never be added to this list. + +# TODO(ecosystem): Remove everything from this list. See +# https://github.com/flutter/flutter/issues/102679 +- camera_web +- espresso +- google_maps_flutter/google_maps_flutter +- google_sign_in/google_sign_in +- google_sign_in_web +- image_picker/image_picker +- image_picker_for_web +- in_app_purchase/in_app_purchase +- ios_platform_images +- path_provider/path_provider +- plugin_platform_interface +- quick_actions/quick_actions +- shared_preferences/shared_preferences +- webview_flutter/webview_flutter +- webview_flutter_android +- webview_flutter_web From 477be22189d7c3b97b1a0c12bdc44597d32923de Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 12 Dec 2022 10:34:33 -0500 Subject: [PATCH 5/5] Restore deleted changelog entries --- packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index cebd90c74d9e..af701d542029 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,6 +1,8 @@ ## 2.2.2 * Modified `README.md` to fix minor syntax issues and added Code Excerpt to `README.md`. +* Updates code for new analysis options. +* Updates code for `no_leading_underscores_for_local_identifiers` lint. ## 2.2.1