getWebViewHeight method

Future<Object> getWebViewHeight()

Return the height of WebViewWidget

Implementation

Future<Object> getWebViewHeight() async {
  String getHeightScript = r"""getWebviewHeight();
      function getWebviewHeight() {
          var element = document.body;
          var height = element.offsetHeight,
              style = window.getComputedStyle(element)
          return ['top', 'bottom']
              .map(function (side) {
                  return parseInt(style["margin-" + side]);
              })
              .reduce(function (total, side) {
                  return total + side;
              }, height)
            }""";
  return await super.runJavaScriptReturningResult(getHeightScript);
}