-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[webview_flutter] add COMMON support for Android WebView initializing #3721
Conversation
6fe7627 to
c2bd154
Compare
c2bd154 to
26659aa
Compare
|
@amirh @mklim @iskakaushik Please Take A Look. |
|
Thanks for the submission! We’re currently working through a large backlog of PRs, and this will require non-trivial review, so it will take some time before we’re able to review it. As explained in CONTRIBUTING.md, votes for the corresponding issue are the primary way we’re prioritizing non-trivial reviews, so we encourage you to file an issue and associate it with this PR. |
|
(As a quick initial note, I'm not sure this is a direct we would want to take; generally Flutter developers expect to be able to control plugin behavior from Dart, in a cross-platform way; this does not allow for either.) |
I've associated this PR to some existing related issues, like flutter/flutter#70731. |
However, many settings, like |
| String userAgent = (String) params.get("userAgent"); | ||
| updateUserAgent(userAgent); | ||
| } | ||
| if (commonIniter != null) commonIniter.initWebView(webView); |
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.
At present, websettings lacks many functions, and its behavior is quite different from that of IOS. It is recommended to agree to the change of PR and wait until webview_flutter had all these settings are satisfied, the initWebView method can be deprecated.
|
Thanks for the submission, but based on recent discussions the team has had about how we want to structure platform-specific plugin logic, this is not an approach we will be going with. A rewrite is underway that will make it much easier to add Android-specific settings where necessary. (In general, however, we want to make configuration, and defaults, consistent across platforms as much as possible. E.g., the right solution for the zoom controls in your example was to build the defaults into the plugin for consistency, and provide cross-platform options for changing them, not requiring all developers to add native code to their project to do that themselves.) |
Add a common way to initialize Android WebView (make more settings) in Android code.
In most cases, an APP has custom common WebView initialization logic, like
WebSettings#setBuiltInZoomControls(boolean),WebSettings#setMixedContentMode(int),WebSettings#setTextZoom(int)etc.Adding all these settings to Flutter WebView params is tedious, and unnecessary mostly,
or else we can put these initialization on our APP's self native code as below:
Fix flutter/flutter#70731, flutter/flutter#48283, flutter/flutter#43595, etc.
Related PRs: #2468, #3325, #3701, #2451
Pre-launch Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.