prepare method

void prepare(
  1. InAppWebViewWebElement webView,
  2. Map<String, dynamic> params
)

Implementation

void prepare(InAppWebViewWebElement webView, Map<String, dynamic> params) {
  webView.iframeContainer.style.display = 'none';
  Map<String, num>? initialSize = params["initialSize"]?.cast<String, num>();
  if (initialSize != null) {
    webView.iframeContainer.style.width =
        initialSize["width"].toString() + 'px';
    webView.iframeContainer.style.height =
        initialSize["height"].toString() + 'px';
  }
  Map<String, dynamic> initialSettings =
      params["initialSettings"].cast<String, dynamic>();
  if (initialSettings.isEmpty) {
    webView.initialSettings = InAppWebViewSettings();
  } else {
    webView.initialSettings = InAppWebViewSettings.fromMap(initialSettings);
  }
  webView.initialUrlRequest = URLRequest.fromMap(
      params["initialUrlRequest"]?.cast<String, dynamic>());
  webView.initialFile = params["initialFile"];
  webView.initialData = InAppWebViewInitialData.fromMap(
      params["initialData"]?.cast<String, dynamic>());
  document.body?.append(webView.iframeContainer);
  webView.prepare();
}