[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).
This commit is contained in:
David Iglesias
2021-09-10 17:36:22 -07:00
committed by GitHub
parent 188d56248a
commit 2b615cad84

View File

@ -49,16 +49,24 @@ const Set<String> _ignoredFullBasenameList = <String>{
// When adding license regexes here, include the copyright info to ensure that
// any new additions are flagged for added scrutiny in review.
final List<RegExp> _thirdPartyLicenseBlockRegexes = <RegExp>[
// Third-party code used in url_launcher_web.
// Third-party code used in url_launcher_web.
RegExp(
r'^// Copyright 2017 Workiva Inc\..*'
r'^// Licensed under the Apache License, Version 2\.0',
multiLine: true,
dotAll: true),
r'^// Copyright 2017 Workiva Inc\..*'
r'^// Licensed under the Apache License, Version 2\.0',
multiLine: true,
dotAll: true,
),
// Third-party code used in google_maps_flutter_web.
RegExp(
r'^// The MIT License [^C]+ Copyright \(c\) 2008 Krasimir Tsonev',
multiLine: true,
),
// bsdiff in flutter/packages.
RegExp(r'// Copyright 2003-2005 Colin Percival\. All rights reserved\.\n'
r'// Use of this source code is governed by a BSD-style license that can be\n'
r'// found in the LICENSE file\.\n'),
RegExp(
r'// Copyright 2003-2005 Colin Percival\. All rights reserved\.\n'
r'// Use of this source code is governed by a BSD-style license that can be\n'
r'// found in the LICENSE file\.\n',
),
];
// The exact format of the BSD license that our license files should contain.