RRect.fromRectAndCorners constructor

RRect.fromRectAndCorners(
  1. Rect rect, {
  2. Radius topLeft = Radius.zero,
  3. Radius topRight = Radius.zero,
  4. Radius bottomRight = Radius.zero,
  5. Radius bottomLeft = Radius.zero,
})

Construct a rounded rectangle from its bounding box and topLeft, topRight, bottomRight, and bottomLeft radii.

The corner radii default to Radius.zero, i.e. right-angled corners. Will assert in debug mode if any of the radii are negative in either x or y.

Implementation

RRect.fromRectAndCorners(
  Rect rect, {
  Radius topLeft = Radius.zero,
  Radius topRight = Radius.zero,
  Radius bottomRight = Radius.zero,
  Radius bottomLeft = Radius.zero,
}) : this._raw(
       top: rect.top,
       left: rect.left,
       right: rect.right,
       bottom: rect.bottom,
       tlRadiusX: topLeft.x,
       tlRadiusY: topLeft.y,
       trRadiusX: topRight.x,
       trRadiusY: topRight.y,
       blRadiusX: bottomLeft.x,
       blRadiusY: bottomLeft.y,
       brRadiusX: bottomRight.x,
       brRadiusY: bottomRight.y,
     );