ZoneInfo class

Holds information about the start and end positions of a zone.

A zone represents a rectangular region in the terminal that can be used for mouse event hit testing. Zones are created by wrapping content with ZoneManager.mark and then scanning the output with ZoneManager.scan.

Example

// In your view method:
final button = zone.mark('my-button', 'Click Me');

// In your update method:
final zoneInfo = zone.get('my-button');
if (zoneInfo?.inBounds(mouseMsg) ?? false) {
  // Handle click
}

Constructors

ZoneInfo({required String id, required int startX, required int startY, required int endX, required int endY, int iteration = 0})
Creates a zone info with the given coordinates.

Properties

endX → int
The x coordinate of the bottom right cell of the zone (0-based).
final
endY → int
The y coordinate of the bottom right cell of the zone (0-based).
final
hashCode → int
The hash code for this object.
no setteroverride
height → int
The height of this zone in rows.
no setter
id → String
The user-provided ID for this zone.
final
isZero → bool
Returns true if this zone info represents an unknown/invalid zone.
no setter
iteration → int
The iteration this zone was created in (used for cleanup).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
startX → int
The x coordinate of the top left cell of the zone (0-based).
final
startY → int
The y coordinate of the top left cell of the zone (0-based).
final
width → int
The width of this zone in columns.
no setter

Methods

inBounds(MouseMsg msg) → bool
Returns true if the mouse event was in the bounds of this zone's coordinates.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pos(MouseMsg msg) → ({int x, int y})
Returns the coordinates of the mouse event relative to this zone.
toString() → String
A string representation of this object.
override
withEnd({required int endX, required int endY}) → ZoneInfo
Creates a copy with updated end coordinates.

Operators

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