WebViewAndroidPlatformController constructor
WebViewAndroidPlatformController({
- required bool useHybridComposition,
- required CreationParams creationParams,
- required WebViewPlatformCallbacksHandler callbacksHandler,
- required JavascriptChannelRegistry javascriptChannelRegistry,
- @visibleForTesting WebViewProxy webViewProxy = const WebViewProxy(),
- @visibleForTesting FlutterAssetManager flutterAssetManager = const android_webview.FlutterAssetManager(),
- @visibleForTesting WebStorage? webStorage,
Construct a WebViewAndroidPlatformController.
Implementation
WebViewAndroidPlatformController({
required bool useHybridComposition,
required CreationParams creationParams,
required this.callbacksHandler,
required this.javascriptChannelRegistry,
@visibleForTesting this.webViewProxy = const WebViewProxy(),
@visibleForTesting
this.flutterAssetManager = const android_webview.FlutterAssetManager(),
@visibleForTesting android_webview.WebStorage? webStorage,
}) : webStorage = webStorage ?? android_webview.WebStorage.instance,
assert(creationParams.webSettings?.hasNavigationDelegate != null),
super(callbacksHandler) {
webView = webViewProxy.createWebView(
useHybridComposition: useHybridComposition,
);
webView.settings.setDomStorageEnabled(true);
webView.settings.setJavaScriptCanOpenWindowsAutomatically(true);
webView.settings.setSupportMultipleWindows(true);
webView.settings.setLoadWithOverviewMode(true);
webView.settings.setUseWideViewPort(true);
webView.settings.setDisplayZoomControls(false);
webView.settings.setBuiltInZoomControls(true);
_setCreationParams(creationParams);
webView.setDownloadListener(downloadListener);
webView.setWebChromeClient(webChromeClient);
final String? initialUrl = creationParams.initialUrl;
if (initialUrl != null) {
loadUrl(initialUrl, <String, String>{});
}
}