Rect class

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

A Rect can be created with one of its constructors or from an Offset and a Size using the & operator:

Rect myRect = const Offset(1.0, 2.0) & const Size(3.0, 4.0);

Constructors

Rect.fromCenter({required Offset center, required double width, required double height})
Constructs a rectangle from its center point, width, and height.
Rect.fromCircle({required Offset center, required 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.
const
Rect.fromLTWH(double left, double top, double width, double height)
Construct a rectangle from its left and top edges, its width, and its height.
const
Rect.fromPoints(Offset a, Offset b)
Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin.

Properties

bottom double
The offset of the bottom edge of this rectangle from the y axis.
final
hashCode int
The hash code for this object.
no setterinherited
height double
no setter
left double
The offset of the left edge of this rectangle from the x axis.
final
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
top double
The offset of the top edge of this rectangle from the y axis.
final
width double
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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