flutter_html_iframe

Iframe widget for flutter_html.

This package renders iframes using the webview_flutter plugin.

When rendering iframes, the package considers the width, height, and sandbox attributes.

Sandbox controls the JavaScript mode of the webview - a value of null or allow-scripts will set javascriptMode: JavascriptMode.unrestricted, otherwise it will set javascriptMode: JavascriptMode.disabled.

Registering the CustomRender:

Widget html = Html(
  customRenders: {
    iframeMatcher(): iframeRender(),
  }
);

You can set the navigationDelegate of the webview with the navigationDelegate property on iframeRender. This allows you to block or allow the loading of certain URLs.

Widget html = Html(
  customRenders: {
    iframeMatcher(): iframeRender(navigationDelegate: (NavigationRequest request) {
      if (request.url.contains("google.com/images")) {
        return NavigationDecision.prevent;
      } else {
        return NavigationDecision.navigate;
      }
    }),
  }
);

Libraries

flutter_html_iframe
iframe_mobile
iframe_unsupported
iframe_web
shims/dart_ui
This file shims dart:ui in web-only scenarios, getting rid of the need to suppress analyzer warnings.
shims/dart_ui_fake
shims/dart_ui_real