RRect class

An immutable rounded rectangle with the custom radii for all four corners.

Constructors

RRect.fromLTRBAndCorners(double left, double top, double right, double bottom, {Radius topLeft = Radius.zero, Radius topRight = Radius.zero, Radius bottomRight = Radius.zero, Radius bottomLeft = Radius.zero})
Construct a rounded rectangle from its left, top, right, and bottom edges, and topLeft, topRight, bottomRight, and bottomLeft radii.
RRect.fromLTRBR(double left, double top, double right, double bottom, Radius radius)
Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in each corner.
RRect.fromLTRBXY(double left, double top, double right, double bottom, double radiusX, double radiusY)
Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radii along its horizontal axis and its vertical axis.
const
RRect.fromRectAndCorners(Rect rect, {Radius topLeft = Radius.zero, Radius topRight = Radius.zero, Radius bottomRight = Radius.zero, Radius bottomLeft = Radius.zero})
Construct a rounded rectangle from its bounding box and topLeft, topRight, bottomRight, and bottomLeft radii.
RRect.fromRectAndRadius(Rect rect, Radius radius)
Construct a rounded rectangle from its bounding box and a radius that is the same in each corner.
RRect.fromRectXY(Rect rect, double radiusX, double radiusY)
Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis and its vertical axis.

Properties

blRadius Radius
The bottom-left Radius.
no setter
blRadiusX double
The bottom-left horizontal radius.
final
blRadiusY double
The bottom-left vertical radius.
final
bottom double
The offset of the bottom edge of this rectangle from the y axis.
final
brRadius Radius
The bottom-right Radius.
no setter
brRadiusX double
The bottom-right horizontal radius.
final
brRadiusY double
The bottom-right vertical radius.
final
center Offset
The offset to the point halfway between the left and right and the top and bottom edges of this rectangle.
no setter
hashCode int
The hash code for this object.
no setteroverride
hasNaN bool
Whether any of the dimensions are NaN.
no setter
height double
The distance between the top and bottom edges of this rectangle.
no setter
isCircle bool
Whether this rounded rectangle would draw as a circle.
no setter
isEllipse bool
Whether this rounded rectangle has no side with a straight section.
no setter
isEmpty bool
Whether this rounded rectangle encloses a non-zero area. Negative areas are considered empty.
no setter
isFinite bool
Whether all coordinates of this rounded rectangle are finite.
no setter
isRect bool
Whether this rounded rectangle is a simple rectangle with zero corner radii.
no setter
isStadium bool
Whether this rounded rectangle has a side with no straight section.
no setter
left double
The offset of the left edge of this rectangle from the x axis.
final
longestSide double
The greater of the magnitudes of the width and the height of this rounded rectangle.
no setter
middleRect Rect
The rectangle that would be formed using the axis-aligned intersection of the sides of the rectangle, i.e., the rectangle formed from the inner-most centers of the ellipses that form the corners. This is the intersection of the wideMiddleRect and the tallMiddleRect. If any of the intersections are void, the resulting Rect will have negative width or height.
no setter
outerRect Rect
The bounding box of this rounded rectangle (the rectangle with no rounded corners).
no setter
The offset of the right edge of this rectangle from the x axis.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
safeInnerRect Rect
The non-rounded rectangle that is constrained by the smaller of the two diagonals, with each diagonal traveling through the middle of the curve corners. The middle of a corner is the intersection of the curve with its respective quadrant bisector.
no setter
shortestSide double
The lesser of the magnitudes of the width and the height of this rounded rectangle.
no setter
tallMiddleRect Rect
The biggest rectangle that is entirely inside the rounded rectangle and has the full height of the rounded rectangle. If the rounded rectangle does not have an axis-aligned intersection of its top and bottom side, the resulting Rect will have negative width or height.
no setter
tlRadius Radius
The top-left Radius.
no setter
tlRadiusX double
The top-left horizontal radius.
final
tlRadiusY double
The top-left vertical radius.
final
top double
The offset of the top edge of this rectangle from the y axis.
final
trRadius Radius
The top-right Radius.
no setter
trRadiusX double
The top-right horizontal radius.
final
trRadiusY double
The top-right vertical radius.
final
wideMiddleRect Rect
The biggest rectangle that is entirely inside the rounded rectangle and has the full width of the rounded rectangle. If the rounded rectangle does not have an axis-aligned intersection of its left and right side, the resulting Rect will have negative width or height.
no setter
width double
The distance between the left and right edges of this rectangle.
no setter

Methods

contains(Offset point) bool
Whether the point specified by the given offset (which is assumed to be relative to the origin) lies inside the rounded rectangle.
deflate(double delta) RRect
Returns a new RRect with edges and radii moved inwards by the given delta.
inflate(double delta) RRect
Returns a new RRect with edges and radii moved outwards by the given delta.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scaleRadii() RRect
Scales all radii so that on each side their sum will not exceed the size of the width/height.
shift(Offset offset) RRect
Returns a new RRect translated by the given offset.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

lerp(RRect? a, RRect? b, double t) RRect?
Linearly interpolate between two rounded rectangles.

Constants

zero → const RRect
A rounded rectangle with all the values set to zero.