transformRect method

Rect transformRect(
  1. Rect rect
)

Implementation

Rect transformRect(Rect rect) {
  final Offset topLeft = transformOffset(rect.topLeft);
  final Offset topRight = transformOffset(rect.topRight);
  final Offset bottomLeft = transformOffset(rect.bottomLeft);
  final Offset bottomRight = transformOffset(rect.bottomRight);

  double left =
      [topLeft.dx, topRight.dx, bottomLeft.dx, bottomRight.dx].reduce(min);
  double right =
      [topLeft.dx, topRight.dx, bottomLeft.dx, bottomRight.dx].reduce(max);
  double top =
      [topLeft.dy, topRight.dy, bottomLeft.dy, bottomRight.dy].reduce(min);
  double bottom =
      [topLeft.dy, topRight.dy, bottomLeft.dy, bottomRight.dy].reduce(max);

  return Rect.fromLTRB(left, top, right, bottom);
}