IntRect class

A class representing a rectangle with integer coordinates and dimensions.

Constructors

IntRect([int left = 0, int top = 0, int width = 0, int height = 0])
Creates a new IntRect with the specified position and dimensions.
IntRect.fromCenter({required IntOffset center, required int width, required int height})
Creates a new IntRect from center point, width, and height values.
factory
IntRect.fromLTRB(int left, int top, int right, int bottom)
Creates a new IntRect from left, top, right, and bottom edges.
factory
IntRect.fromLTWH(int left, int top, int width, int height)
Creates a new IntRect from left, top, width, and height values.
factory

Properties

bottom → int
The y-coordinate of the bottom edge of the rectangle.
no setter
bottomCenter → IntOffset
The bottom-center point of the rectangle.
no setter
bottomLeft → IntOffset
The bottom-left corner of the rectangle.
no setter
bottomRight → IntOffset
The bottom-right corner of the rectangle.
no setter
center → IntOffset
The center point of the rectangle.
no setter
centerLeft → IntOffset
The center-left point of the rectangle.
no setter
centerRight → IntOffset
The center-right point of the rectangle.
no setter
hashCode → int
The hash code for this object.
no setterinherited
height → int
The height of the rectangle.
final
isEmpty → bool
True if there is not size to this rect
no setter
left → int
The x-coordinate of the left edge of the rectangle.
final
The x-coordinate of the right edge of the rectangle.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
top → int
The y-coordinate of the top edge of the rectangle.
final
topCenter → IntOffset
The top-center point of the rectangle.
no setter
topLeft → IntOffset
The top-left corner of the rectangle.
no setter
topRight → IntOffset
The top-right corner of the rectangle.
no setter
width → int
The width of the rectangle.
final

Methods

contains(int x, int y) → bool
Checks if the given point (x, y) is contained within this rectangle.
containsOffset(IntOffset offset) → bool
Checks if the given offset point is contained within this rectangle.
containsRect(IntRect rect) → bool
Checks if another rectangle is completely contained within this rectangle.
expandToInclude(IntRect input) → IntRect
Creates a new rectangle that includes both this rectangle and the input rectangle.
intersect(IntRect other) → IntRect
Calculates the intersection of this rectangle with another rectangle.
intersectHorizontal(IntRect other) → bool
Checks if this rectangle intersects horizontally with another rectangle.
intersects(IntRect other) → bool
Checks if this rectangle intersects with another rectangle.
intersectVertically(IntRect other) → bool
Checks if this rectangle intersects vertically with another rectangle.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shift(IntOffset offset) → IntRect
Creates a new rectangle shifted by the specified amounts.
toString() → String
Returns a string representation of this rectangle.
override
translate(int dx, int dy) → IntRect
Creates a new rectangle translated by the specified amounts.

Operators

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

Static Properties

zero → IntRect
Creates a new IntRect with zero position and dimensions.
final