calculateBoundaryBox static method

Rect calculateBoundaryBox({
  1. required Offset position,
  2. required Size size,
  3. EdgeInsets padding = EdgeInsets.zero,
})

Calculates the boundary box for a widget given its position, size, and padding.

Implementation

static Rect calculateBoundaryBox({
  required Offset position,
  required Size size,
  EdgeInsets padding = EdgeInsets.zero,
}) {
  return Rect.fromLTRB(
    position.dx - padding.left,
    position.dy - padding.top,
    position.dx + size.width + padding.right,
    position.dy + size.height + padding.bottom,
  );
}