getPositionOnScreen method

Offset getPositionOnScreen(
  1. BuildContext _buildContext
)

Returns the offset from screen top (and left?) when the WebView is close to screen top the offset.dy will return close to 0 result.

Implementation

Offset getPositionOnScreen(BuildContext _buildContext) {
  final RenderObject? renderBoxRed = _buildContext.findRenderObject();
  if (renderBoxRed != null && renderBoxRed is RenderBox) {
    return renderBoxRed.localToGlobal(Offset.zero);
  }

  return Offset(0, 0);
}