getWidgetBounds static method

Rect getWidgetBounds(
  1. BuildContext context
)

get Widget Bounds (width, height, left, top, right, bottom and so on).Widgets must be rendered completely. 获取widget Rect

Implementation

static Rect getWidgetBounds(BuildContext context) {
  RenderBox? box = getRenderBox(context);
  return box?.semanticBounds ?? Rect.zero;
}