Rect class

A rectangular area in the terminal coordinate system.

Defined by its top-left corner x, y and width, height.

Available extensions

Constructors

Rect(int x, int y, int width, int height)
const

Properties

area int
Total area in character cells.
no setter
bottom int
no setter
columns Iterable<Rect>

Available on Rect, provided by the RectIterators extension

Yields each column as a full-height Rect of width 1.
no setter
hashCode int
The hash code for this object.
no setteroverride
height int
The height in character cells.
final
isEmpty bool
Whether the rectangle has no area.
no setter
left int
no setter
position Position
no setter
positions Iterable<Position>

Available on Rect, provided by the RectIterators extension

Yields every cell Position in row-major order.
no setter
no setter
rows Iterable<Rect>

Available on Rect, provided by the RectIterators extension

Yields each row as a full-width Rect of height 1.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Size
no setter
top int
no setter
width int
The width in character cells.
final
x int
The x coordinate of the top-left corner.
final
y int
The y coordinate of the top-left corner.
final

Methods

contains(Position position) bool
Whether position is inside this rectangle (inclusive of edges).
inner(int horizontal, int vertical) Rect
Returns a new rect inset by horizontal and vertical margins.
intersection(Rect other) Rect
Returns the overlapping area with other.
intersects(Rect other) bool
Whether this rectangle overlaps with other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resize(Size size) Rect
Returns a new rect with the same origin but different size.
toString() String
A string representation of this object.
override
union(Rect other) Rect
Returns the bounding box containing both rectangles.

Operators

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

Constants

zero → const Rect
A zero-sized rectangle at (0, 0).