-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[google_maps_flutter] Add Google maps flutter platform interface #2577
[google_maps_flutter] Add Google maps flutter platform interface #2577
Conversation
follow up with #2582 |
Wow, this is great! Thanks for the contribution @cylyl! (I've just found out about this, I've been working in Google maps for web for the last couple of weeks or so) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for the PR!
I added some comments with what we have learned writing platform interfaces and plugins in the last couple of months!
I have time to work on this. If you give me permissions in your repo/branch, I can clone it and tackle some of the changes that I wrote about here.
Again, thank you very much for the contribution, really appreciated!
packages/google_maps_flutter/google_maps_flutter/example/ios/.gitignore
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/test/widget_test.dart
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/web/index.html
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/web/index.html
Outdated
Show resolved
Hide resolved
...utter/google_maps_flutter_platform_interface/lib/google_maps_flutter_platform_interface.dart
Outdated
Show resolved
Hide resolved
...utter/google_maps_flutter_platform_interface/lib/google_maps_flutter_platform_interface.dart
Outdated
Show resolved
Hide resolved
...s_flutter/google_maps_flutter_platform_interface/lib/method_channel_google_maps_flutter.dart
Outdated
Show resolved
Hide resolved
...s_flutter/google_maps_flutter_platform_interface/lib/method_channel_google_maps_flutter.dart
Outdated
Show resolved
Hide resolved
...ter/google_maps_flutter_platform_interface/test/method_channel_google_maps_flutter_test.dart
Outdated
Show resolved
Hide resolved
invite sent! |
...s_flutter/google_maps_flutter_platform_interface/lib/method_channel_google_maps_flutter.dart
Outdated
Show resolved
Hide resolved
...s_flutter/google_maps_flutter_platform_interface/lib/method_channel_google_maps_flutter.dart
Outdated
Show resolved
Hide resolved
final MethodChannel channel; | ||
MethodChannel get channel { | ||
return _googleMapsFlutterPlatform.channel; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plugin cannot use the MethodChannel for anything. The MethodChannel is only used as an implementation of the GoogleMaps platform for certain devices. We need to remove the need for an instance of the channel within the plugin (I'll give this a try later as well!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required for the e2e tests (which won't work in mobile, then). This is an issue for the full migration.
Hey @cylyl, are you testing the lib in mobile (device or emu) to make sure that this is still working as expected, could you take a look at my changes and see if they make sense to you? Thanks! |
ok |
Hey @cylyl I intend to rebase the branch with the latest master and push-force. Do you have any work in progress in the google_maps_flutter_platform_interface branch of your repo? |
* Make the method_channel implementation private, so it can't be imported from other packages. * Fix all the problems with Future<void> functions not returning a future.
@cylyl note that there has been a new method added to the platform_interface that you might want to check if it can be implemented: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM but needs to be split up so the platform interface changes can land before the plugin changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM but needs to be split up so the platform interface changes can land before the plugin changes
You're right, I'll get that done ASAP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some nits, this PR is too long to be an afternoon review :) Will continue reviewing tomorrow when i have a refreshed mind :)
packages/google_maps_flutter/google_maps_flutter/example/.gitignore
Outdated
Show resolved
Hide resolved
..._maps_flutter/example/android/app/src/main/kotlin/io/flutter/plugins/example/MainActivity.kt
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/ios/.gitignore
Outdated
Show resolved
Hide resolved
...utter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/ios/Runner/AppDelegate.swift
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/ios/Runner/Runner-Bridging-Header.h
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did another round of review, left some comments. :)
packages/google_maps_flutter/google_maps_flutter_platform_interface/README.md
Show resolved
Hide resolved
...ges/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/events/map_event.dart
Outdated
Show resolved
Hide resolved
...ps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart
Outdated
Show resolved
Hide resolved
...ps_flutter_platform_interface/lib/src/method_channel/method_channel_google_maps_flutter.dart
Outdated
Show resolved
Hide resolved
|
||
/// Updates configuration options of the map user interface. | ||
/// | ||
/// Change listeners are notified once the update has been made on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are change listeners? Could we include a reference here?
ditto below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea, this comment comes verbatim from the old implementation.
Map<String, dynamic> creationParams, | ||
Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers, | ||
PlatformViewCreatedCallback onPlatformViewCreated) { | ||
if (defaultTargetPlatform == TargetPlatform.android) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little weird that the platform_interface contains platform specific code, is there a way we can avoid this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the MethodChannel implementation, which can be platform-specific (at least for the devices that use MethodChannel).
It needs to live in this package, so it can be the "default" implementation, if the plugin is not overriding anything.
(This code is platform-specific already, because it uses MethodChannels, pretty much)
...maps_flutter_platform_interface/lib/src/platform_interface/google_maps_flutter_platform.dart
Outdated
Show resolved
Hide resolved
...maps_flutter_platform_interface/lib/src/platform_interface/google_maps_flutter_platform.dart
Outdated
Show resolved
Hide resolved
The tests that are failing are those that are using methods on the |
The failing tests were a flake. I ran them manually (and asked on discord) and eventually they passed in Cirrus. I'll split this PR in two; one with the platform_interface only code, and another one with the core plugin changes. |
Please @cylyl, can you add the following comment in my PR? It is needed to authorize me to push changes with your username from my repository: @googlebot I consent. Here is a similar (not identical) example in another PR. Thanks! |
Description
A common platform interface for the google_maps_flutter plugin.
This interface allows platform-specific implementations of the google_maps_flutter plugin, as well as the plugin itself, to ensure they are supporting the same interface.
Related Issues
flutter/flutter#45292
Checklist
///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?