New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[webview_flutter] Added missing settings when developing initial AndroidWebViewController #6740
base: v4_webview
Are you sure you want to change the base?
[webview_flutter] Added missing settings when developing initial AndroidWebViewController #6740
Conversation
I don't think we should expose support for the following methods yet.
setBuiltInZoomControls
setDisplayZoomControls
setJavaScriptCanOpenWindowsAutomatically
setLoadWithOverviewMode
setSupportMultipleWindows
setUseWideViewPort
All of these are called on the WebView in the constructor because they are required to display the WebView correctly as a PlatformView.
These should just be set in the constructor to the same values we have in the current implementation:
| @override | ||
| Future<void> setUserAgent(String? userAgent) => | ||
| _webView.settings.setUserAgentString(userAgent); | ||
|
|
||
| /// Sets the restrictions that apply on automatic media playback. | ||
| Future<void> setAutoMediaPlaybackPolicy( |
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.
Since this is Android only, I think this would be better as setMediaPlaybackRequiresUserGesture(bool). The enum was used before because iOS could set the specific media that requires gestures.
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.
Updated the method callback to match the Android specific name.
Updated the |
| /// default value is true for apps targeting Build.VERSION_CODES.Q and below, | ||
| /// and false when targeting Build.VERSION_CODES.R and above. | ||
| Future<void> enableFileAccess(bool enabled) => | ||
| _webView.settings.setAllowFileAccess(enabled); |
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.
Ah, I forgot about this one. This is already called in the loadFile method. enableFileAccess can be removed.


Added the following setters which I missed during initial development:
setBuiltInZoomControlssetDisplayZoomControlssetJavaScriptCanOpenWindowsAutomaticallysetLoadWithOverviewModesetSupportMultipleWindowssetUseWideViewPortPart of issue flutter/flutter#94051
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.