fromCenter static method

Rect fromCenter({
  1. required Vector2 center,
  2. required double width,
  3. required double height,
})

Constructs a Rect with a width and height around the center point.

Implementation

static Rect fromCenter({
  required Vector2 center,
  required double width,
  required double height,
}) {
  return Rect.fromLTRB(
    center.x - width / 2,
    center.y - height / 2,
    center.x + width / 2,
    center.y + height / 2,
  );
}