RelativeRect class

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.

Annotations

Constructors

RelativeRect.fromDirectional({required TextDirection textDirection, required double start, required double top, required double end, required double bottom})
Creates a RelativeRect from horizontal position using start and end rather than left and right.
factory
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.
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.

Properties

bottom double
Distance from the bottom side of the container to the bottom side of this rectangle.
final
hashCode int
The hash code for this object.
no setteroverride
hasInsets bool
Returns whether any of the values are greater than zero.
no setter
left double
Distance from the left side of the container to the left side of this rectangle.
final
Distance from the right side of the container to the right side of this rectangle.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
top double
Distance from the top side of the container to the top side of this rectangle.
final

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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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.
toSize(Size container) Size
Convert this RelativeRect to a Size, assuming a container with the given size.
toString() String
A string representation of this object.
override

Operators

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

Static Methods

lerp(RelativeRect? a, RelativeRect? b, double t) RelativeRect?
Linearly interpolate between two RelativeRects.

Constants

fill → const RelativeRect
A rect that covers the entire container.