getWidgetRectGlobalToLocal method

Rect? getWidgetRectGlobalToLocal({
  1. Offset point = Offset.zero,
  2. RenderObject? ancestor,
})

Get the Rect of the widget on the screen.Widgets must be rendered completely. 获取widget在屏幕上的Rect,widget必须渲染完成

Implementation

Rect? getWidgetRectGlobalToLocal(
    {Offset point = Offset.zero, RenderObject? ancestor}) {
  final RenderBox? box = getRenderBox;
  return box == null
      ? null
      : box.globalToLocal(point, ancestor: ancestor) & box.size;
}