createPlatformWebViewWidgetCreationParams static method

PlatformWebViewWidgetCreationParams createPlatformWebViewWidgetCreationParams(
  1. WebViewController webViewController,
  2. Set<Factory<TBLWebViewGestureRecognizer>> savedFactoryRecognizers
)

Creates the parameters for the webview widget

Implementation

static PlatformWebViewWidgetCreationParams
    createPlatformWebViewWidgetCreationParams(
        WebViewController webViewController,
        Set<Factory<TBLWebViewGestureRecognizer>> savedFactoryRecognizers) {
  PlatformWebViewWidgetCreationParams webViewWidgetParam =
      PlatformWebViewWidgetCreationParams(
    controller: webViewController.platform,
    gestureRecognizers: savedFactoryRecognizers,
  );

  if (WebViewPlatform.instance is WebKitWebViewPlatform) {
    webViewWidgetParam = WebKitWebViewWidgetCreationParams
        .fromPlatformWebViewWidgetCreationParams(
      webViewWidgetParam,
    );
  } else if (WebViewPlatform.instance is AndroidWebViewPlatform) {
    webViewWidgetParam = AndroidWebViewWidgetCreationParams
        .fromPlatformWebViewWidgetCreationParams(webViewWidgetParam,
            // Taboola Feed implementation is not handled well by WebView texture rendering implementation. Despite limiting the WebView size, the texture rendered keeps growing, causing a crash.
            // Therefore Taboola requires using 'Hybrid Composition' rendering mode. According to WebView.platform documentaiton "Setting `platform` doesn't affect [WebView]s that were already created."
            // Notice: It is known that 'Hybrid Composition' comes at a cost of some performance on Android versions below 10.
            displayWithHybridComposition: true);
  }
  return webViewWidgetParam;
}