buildWebView method

Widget buildWebView (
  1. BuildMetadata meta,
  2. String url,
  3. {double height,
  4. double width}
)

Builds WebView.

Implementation

Widget buildWebView(
  BuildMetadata meta,
  String url, {
  double height,
  double width,
}) {
  if (_widget?.webView != true) return buildWebViewLinkOnly(meta, url);

  final dimensOk = height != null && height > 0 && width != null && width > 0;
  return WebView(
    url,
    aspectRatio: dimensOk ? width / height : 16 / 9,
    autoResize: !dimensOk && _widget.webViewJs == true,
    interceptNavigationRequest: (newUrl) {
      if (newUrl == url) return false;

      gestureTapCallback(newUrl)();
      return true;
    },
    js: _widget.webViewJs == true,
    unsupportedWorkaroundForIssue37:
        _widget.unsupportedWebViewWorkaroundForIssue37 == true,
  );
}