An immutable 2D, axis-aligned, floating-point rectangle whose coordinates
are given relative to another rectangle's edges, known as the container.
Since the dimensions of the rectangle are relative to those of the
container, this class has no width and height members. To determine the
width or height of the rectangle, convert it to a Rect using toRect()
(passing the container's own Rect), and then examine that object.
If you create the RelativeRect with null values, the methods on RelativeRect will not work usefully (or at all).
Static Properties
- fill → RelativeRect
-
A rect that covers the entire container.
read-only
Static Methods
-
lerp(
RelativeRect a, RelativeRect b, double t) → RelativeRect -
Linearly interpolate between two RelativeRects.
Constructors
- RelativeRect.fromLTRB(double left, double top, double right, double bottom)
-
Creates a RelativeRect with the given values.
const - RelativeRect.fromRect(Rect rect, Rect container)
-
Creates a RelativeRect from two Rects. The second Rect provides the container, the first provides the rectangle, in the same coordinate space, that is to be converted to a RelativeRect. The output will be in the container's coordinate space.
factory - RelativeRect.fromSize(Rect rect, Size container)
-
Creates a RelativeRect from a Rect and a Size. The Rect (first argument) and the RelativeRect (the output) are in the coordinate space of the rectangle described by the Size, with 0,0 being at the top left.
factory
Properties
- bottom → double
-
Distance from the bottom side of the container to the bottom side of this rectangle.
read-only - hashCode → int
-
read-only
- left → double
-
Distance from the left side of the container to the left side of this rectangle.
read-only - right → double
-
Distance from the right side of the container to the right side of this rectangle.
read-only - top → double
-
Distance from the top side of the container to the top side 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
-
deflate(
double delta) → RelativeRect -
Returns a new rectangle with edges moved inwards by the given delta.
-
inflate(
double delta) → RelativeRect -
Returns a new rectangle with edges moved outwards by the given delta.
-
intersect(
RelativeRect other) → RelativeRect -
Returns a new rectangle that is the intersection of the given rectangle and this rectangle.
-
shift(
Offset offset) → RelativeRect -
Returns a new rectangle object translated by the given offset.
-
toRect(
Rect container) → Rect -
Convert this RelativeRect to a Rect, in the coordinate space of the container.
-
toString(
) → String -
Returns a string representation of this object.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited