diff --git a/example/integration_test/headless_in_app_webview/convert_to_inappwebview.dart b/example/integration_test/headless_in_app_webview/convert_to_inappwebview.dart index c0f128b8..53d36875 100644 --- a/example/integration_test/headless_in_app_webview/convert_to_inappwebview.dart +++ b/example/integration_test/headless_in_app_webview/convert_to_inappwebview.dart @@ -40,7 +40,7 @@ void convertToInAppWebView() { expect(url, TEST_CROSS_PLATFORM_URL_1.toString()); final Completer widgetControllerCompleter = - Completer(); + Completer(); final Completer loadedUrl = Completer(); await tester.pumpWidget( @@ -61,11 +61,13 @@ void convertToInAppWebView() { ), ), ); - final InAppWebViewController widgetController = await widgetControllerCompleter.future; + final InAppWebViewController widgetController = + await widgetControllerCompleter.future; expect(headlessWebView.isRunning(), false); - expect((await widgetController.getUrl())?.toString(), TEST_CROSS_PLATFORM_URL_1.toString()); + expect((await widgetController.getUrl())?.toString(), + TEST_CROSS_PLATFORM_URL_1.toString()); await widgetController.loadUrl( urlRequest: URLRequest(url: TEST_CROSS_PLATFORM_URL_2)); diff --git a/lib/src/in_app_webview/headless_in_app_webview.dart b/lib/src/in_app_webview/headless_in_app_webview.dart index 6efb0419..c0c9ca12 100644 --- a/lib/src/in_app_webview/headless_in_app_webview.dart +++ b/lib/src/in_app_webview/headless_in_app_webview.dart @@ -722,4 +722,4 @@ extension InternalHeadlessInAppWebView on HeadlessInAppWebView { _started = false; _running = false; } -} \ No newline at end of file +} diff --git a/lib/src/in_app_webview/in_app_webview.dart b/lib/src/in_app_webview/in_app_webview.dart index ad450933..35d233d3 100755 --- a/lib/src/in_app_webview/in_app_webview.dart +++ b/lib/src/in_app_webview/in_app_webview.dart @@ -625,7 +625,10 @@ class _InAppWebViewState extends State { webViewHtmlElement.initialUrlRequest = widget.initialUrlRequest; webViewHtmlElement.initialFile = widget.initialFile; webViewHtmlElement.initialData = widget.initialData; - webViewHtmlElement.headlessWebViewId = widget.headlessWebView?.isRunning() ?? false ? widget.headlessWebView?.id : null; + webViewHtmlElement.headlessWebViewId = + widget.headlessWebView?.isRunning() ?? false + ? widget.headlessWebView?.id + : null; webViewHtmlElement.prepare(); if (webViewHtmlElement.headlessWebViewId == null) { webViewHtmlElement.makeInitialLoad(); @@ -672,7 +675,10 @@ class _InAppWebViewState extends State { 'initialSettings': initialSettings, 'contextMenu': widget.contextMenu?.toMap() ?? {}, 'windowId': widget.windowId, - 'headlessWebViewId': widget.headlessWebView?.isRunning() ?? false ? widget.headlessWebView?.id : null, + 'headlessWebViewId': + widget.headlessWebView?.isRunning() ?? false + ? widget.headlessWebView?.id + : null, 'implementation': widget.implementation.toNativeValue(), 'initialUserScripts': widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? @@ -700,7 +706,9 @@ class _InAppWebViewState extends State { 'initialSettings': initialSettings, 'contextMenu': widget.contextMenu?.toMap() ?? {}, 'windowId': widget.windowId, - 'headlessWebViewId': widget.headlessWebView?.isRunning() ?? false ? widget.headlessWebView?.id : null, + 'headlessWebViewId': widget.headlessWebView?.isRunning() ?? false + ? widget.headlessWebView?.id + : null, 'implementation': widget.implementation.toNativeValue(), 'initialUserScripts': widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], @@ -723,7 +731,9 @@ class _InAppWebViewState extends State { 'initialSettings': initialSettings, 'contextMenu': widget.contextMenu?.toMap() ?? {}, 'windowId': widget.windowId, - 'headlessWebViewId': widget.headlessWebView?.isRunning() ?? false ? widget.headlessWebView?.id : null, + 'headlessWebViewId': widget.headlessWebView?.isRunning() ?? false + ? widget.headlessWebView?.id + : null, 'implementation': widget.implementation.toNativeValue(), 'initialUserScripts': widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], @@ -754,7 +764,9 @@ class _InAppWebViewState extends State { } void _onPlatformViewCreated(int id) { - final viewId = (!kIsWeb && (widget.headlessWebView?.isRunning() ?? false)) ? widget.headlessWebView?.id : id; + final viewId = (!kIsWeb && (widget.headlessWebView?.isRunning() ?? false)) + ? widget.headlessWebView?.id + : id; widget.headlessWebView?.internalDispose(); _controller = InAppWebViewController(viewId, widget); widget.pullToRefreshController?.initMethodChannel(viewId); diff --git a/lib/src/web/headless_inappwebview_manager.dart b/lib/src/web/headless_inappwebview_manager.dart index 06f7a1af..7d85d908 100644 --- a/lib/src/web/headless_inappwebview_manager.dart +++ b/lib/src/web/headless_inappwebview_manager.dart @@ -62,8 +62,10 @@ class HeadlessInAppWebViewManager { webView.iframeContainer.style.display = 'none'; Map? initialSize = params["initialSize"]?.cast(); if (initialSize != null) { - webView.iframeContainer.style.width = initialSize["width"].toString() + 'px'; - webView.iframeContainer.style.height = initialSize["height"].toString() + 'px'; + webView.iframeContainer.style.width = + initialSize["width"].toString() + 'px'; + webView.iframeContainer.style.height = + initialSize["height"].toString() + 'px'; } Map initialSettings = params["initialSettings"].cast(); diff --git a/lib/src/web/in_app_web_view_web_element.dart b/lib/src/web/in_app_web_view_web_element.dart index 875fe34e..5068a705 100644 --- a/lib/src/web/in_app_web_view_web_element.dart +++ b/lib/src/web/in_app_web_view_web_element.dart @@ -185,7 +185,8 @@ class InAppWebViewWebElement implements Disposable { void prepare() { if (headlessWebViewId != null) { - final headlessWebView = HeadlessInAppWebViewManager.webViews[headlessWebViewId!]; + final headlessWebView = + HeadlessInAppWebViewManager.webViews[headlessWebViewId!]; if (headlessWebView != null && headlessWebView.webView != null) { final webView = headlessWebView.disposeAndGetFlutterWebView(); if (webView != null) { @@ -211,15 +212,16 @@ class InAppWebViewWebElement implements Disposable { Set sandbox = Set.from(Sandbox.values); - if (settings!.javaScriptEnabled != null && !settings!.javaScriptEnabled!) { + if (settings!.javaScriptEnabled != null && + !settings!.javaScriptEnabled!) { sandbox.remove(Sandbox.ALLOW_SCRIPTS); } iframe.allow = settings!.iframeAllow ?? iframe.allow; iframe.allowFullscreen = settings!.iframeAllowFullscreen ?? iframe.allowFullscreen; - iframe.referrerPolicy = - settings!.iframeReferrerPolicy?.toNativeValue() ?? iframe.referrerPolicy; + iframe.referrerPolicy = settings!.iframeReferrerPolicy?.toNativeValue() ?? + iframe.referrerPolicy; iframe.name = settings!.iframeName ?? iframe.name; iframe.csp = settings!.iframeCsp ?? iframe.csp;