Rect.fromCenter constructor

Rect.fromCenter({Offset center, double width, double height })

Constructs a rectangle from its center point, width, and height.

The center argument is assumed to be an offset from the origin.

Implementation

Rect.fromCenter({ Offset center, double width, double height }) : this.fromLTRB(
  center.dx - width / 2,
  center.dy - height / 2,
  center.dx + width / 2,
  center.dy + height / 2,
);