rect property

Rect get rect

Implementation

Rect get rect {
  if (corners.isEmpty) return Rect.zero;
  double left = corners.first.dx;
  double top = corners.first.dy;
  double right = left;
  double bottom = top;
  for (final Offset point in corners) {
    if (point.dx < left) left = point.dx;
    if (point.dx > right) right = point.dx;
    if (point.dy < top) top = point.dy;
    if (point.dy > bottom) bottom = point.dy;
  }
  return Rect.fromLTRB(left, top, right, bottom);
}