inflateRRect method
- RRect rect
Returns a new RRect expanded by this EdgeInsets, increasing each corner's radius by the corresponding per-axis inset amounts (clamped at zero).
The resulting rectangle's left, top, right, and bottom edges are moved outward by the corresponding inset values. Each corner radius is also expanded by the corresponding inset values on both axes, ensuring that the corner shape is preserved while scaling appropriately.
Corner radii are adjusted per-axis and clamped to be non-negative. For example, the top-left corner radius is expanded by left horizontally and top vertically.
See also:
- deflateRRect, to deflate an RRect rather than inflating it.
- inflateRect, to inflate a Rect rather than an RRect.
- BorderRadius, which is used to define the corner radii of an RRect.
Implementation
RRect inflateRRect(RRect rect) {
return RRect.fromLTRBAndCorners(
rect.left - left,
rect.top - top,
rect.right + right,
rect.bottom + bottom,
topLeft: (rect.tlRadius + Radius.elliptical(left, top)).clamp(minimum: Radius.zero),
topRight: (rect.trRadius + Radius.elliptical(right, top)).clamp(minimum: Radius.zero),
bottomRight: (rect.brRadius + Radius.elliptical(right, bottom)).clamp(minimum: Radius.zero),
bottomLeft: (rect.blRadius + Radius.elliptical(left, bottom)).clamp(minimum: Radius.zero),
);
}