Files
David Iglesias 2b615cad84 [google_maps_flutter_web] Fix getScreenCoordinate, zIndex of Circles (#4298)
This commit:

* uses the zIndex attribute when converting Circle geometry objects.
* ensures that the getScreenCoordinate method works as expected on the web platform.
  * adds tests that can use a fully-rendered Google Map (see projection_test.dart)
    * changes the initialization flow of the web Google Map, so the Controller is only returned to the main plugin when it's ready to work.

In order to test the getScreenCoordinate method, the Controller of a fully-rendered map must be available on the test, so we can retrieve information from an actual map instance. While working on this, it was observed that the Controller was being sent to the programmer before it was truly ready (while the map was still initializing).

Instead of littering the test with imprecise timeouts that may make these tests slower (and flakier) than needed, this PR also changes the initialization process of a GMap slightly so when its Controller is returned to the user of the plugin (onPlatformViewCreated method call), it is truly ready.

For this: 

* Controller.init is immediately called after the controller is created, 
* The plugin waits for the first onTilesloaded event coming from the JS SDK, and then 
* The Controller is sent to the user

This change happens within "private" sections of the plugin, so programmers using the plugin "normally" shouldn't notice any difference whatsoever (only that the GMap might load slightly faster, and the onPlatformViewCreated callback might be firing a few hundred milliseconds later).
2021-09-10 17:36:22 -07:00
..
2021-04-29 20:05:38 -07:00

Flutter Plugin Tools

This is a set of utilities used in the flutter/plugins and flutter/packages repositories. It is no longer explictily maintained as a general-purpose tool for multi-package repositories, so your mileage may vary if using it in other repositories.

Note: The commands in tools are designed to run at the root of the repository or <repository-root>/packages/.

Getting Started

In flutter/plugins, the tool is run from source. In flutter/packages, the published version is used instead. (It is marked as Discontinued since it is no longer maintained as a general-purpose tool, but updates are still published for use in flutter/packages.)

From Source (flutter/plugins only)

Set up:

cd ./script/tool && dart pub get && cd ../../

Run:

dart run ./script/tool/bin/flutter_plugin_tools.dart <args>

Published Version

Set up:

dart pub global activate flutter_plugin_tools

Run:

dart pub global run flutter_plugin_tools <args>

Commands

Run with --help for a full list of commands and arguments, but the following shows a number of common commands being run for a specific plugin.

All examples assume running from source; see above for running the published version instead.

Note that the plugins argument, despite the name, applies to any package. (It will likely be renamed packages in the future.)

Format Code

cd <repository root>
dart run ./script/tool/bin/flutter_plugin_tools.dart format --packages plugin_name

Run the Dart Static Analyzer

cd <repository root>
dart run ./script/tool/bin/flutter_plugin_tools.dart analyze --packages plugin_name

Run Dart Unit Tests

cd <repository root>
dart run ./script/tool/bin/flutter_plugin_tools.dart test --packages plugin_name

Run Dart Integration Tests

cd <repository root>
dart run ./script/tool/bin/flutter_plugin_tools.dart build-examples --packages plugin_name
dart run ./script/tool/bin/flutter_plugin_tools.dart drive-examples --packages plugin_name

Run Native Tests

native-test takes one or more platform flags to run tests for. By default it runs both unit tests and (on platforms that support it) integration tests, but --no-unit or --no-integration can be used to run just one type.

Examples:

cd <repository root>
# Run just unit tests for iOS and Android:
dart run ./script/tool/bin/flutter_plugin_tools.dart native-test --ios --android --no-integration --packages plugin_name
# Run all tests for macOS:
dart run ./script/tool/bin/flutter_plugin_tools.dart native-test --macos --packages plugin_name

Publish a Release

sh cd <path_to_plugins> git checkout <commit_hash_to_publish> dart run ./script/tool/bin/flutter_plugin_tools.dart publish-plugin --package <package>

By default the tool tries to push tags to the upstream remote, but some additional settings can be configured. Run dart run ./script/tool/bin/flutter_plugin_tools.dart publish-plugin --help for more usage information.

The tool wraps pub publish for pushing the package to pub, and then will automatically use git to try to create and push tags. It has some additional safety checking around pub publish too. By default pub publish publishes everything, including untracked or uncommitted files in version control. publish-plugin will first check the status of the local directory and refuse to publish if there are any mismatched files with version control present.

Automated publishing is under development. Follow flutter/flutter#27258 for updates.

Updating the Tool

For flutter/plugins, just changing the source here is all that's needed.

For changes that are relevant to flutter/packages, you will also need to:

  • Update the tool's pubspec.yaml and CHANGELOG
  • Publish the tool
  • Update the pinned version in flutter/packages