An immutable 2D, axis-aligned, floating-point rectangle whose coordinates are relative to an origin point.

Static Properties

zero Rect

A rectangle with left, top, right, and bottom edges all at zero.

read-only

Static Methods

lerp(Rect a, Rect b, double t) Rect

Linearly interpolate between two rectangles.

Constructors

Rect.fromCircle({Point center, double radius })

Construct a rectangle that bounds the given circle.

Rect.fromLTRB(double left, double top, double right, double bottom)

Construct a rectangle from its left, top, right, and bottom edges.

Rect.fromLTWH(double left, double top, double width, double height)

Construct a rectangle from its left and top edges, its width, and its height.

Rect.fromPoints(Point a, Point b)

Construct the smallest rectangle that encloses the given points.

Properties

bottom double

The offset of the bottom edge of this rectangle from the y axis.

read-only
bottomCenter Point

The point at the center of the bottom edge of this rectangle.

read-only
bottomLeft Point

The point at the intersection of the bottom and left edges of this rectangle.

read-only
bottomRight Point

The point at the intersection of the bottom and right edges of this rectangle.

read-only
center Point

The point halfway between the left and right and the top and bottom edges of this rectangle.

read-only
centerLeft Point

The point at the center of the left edge of this rectangle.

read-only
centerRight Point

The point at the center of the right edge of this rectangle.

read-only
hashCode int

read-only
height double

The distance between the top and bottom edges of this rectangle.

read-only
isEmpty bool

Whether this rectangle encloses a non-zero area. Negative areas are considered empty.

read-only
left double

The offset of the left edge of this rectangle from the x axis.

read-only

The offset of the right edge of this rectangle from the x axis.

read-only
shortestSide double

The lesser of the magnitudes of the width and the height of this rectangle.

read-only
size Size

The distance between upper-left corner and the lower-right corner of this rectangle.

read-only
top double

The offset of the top edge of this rectangle from the y axis.

read-only
topCenter Point

The point at the center of the top edge of this rectangle.

read-only
topLeft Point

The point at the intersection of the top and left edges of this rectangle.

read-only
topRight Point

The point at the intersection of the top and right edges of this rectangle.

read-only
width double

The distance between the left and right edges of this rectangle.

read-only
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) bool

The equality operator.

Methods

contains(Point point) bool

Whether the given point lies between the left and right and the top and bottom edges of this rectangle.

deflate(double delta) Rect

Returns a new rectangle with edges moved inwards by the given delta.

inflate(double delta) Rect

Returns a new rectangle with edges moved outwards by the given delta.

intersect(Rect other) Rect

Returns a new rectangle that is the intersection of the given rectangle and this rectangle. The two rectangles must overlap for this to be meaningful. If the two rectangles do not overlap, then the resulting Rect will have a negative width or height.

shift(Offset offset) Rect

Returns a new rectangle translated by the given offset.

toString() String

Returns a string representation of this object.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited