Grid class

A widget that renders a static 2D grid of customized Cells.

It acts like a tile map, copying characters and styles from the provided 2D array directly into the local draw buffer up to the active constraints.

Example Usage

final map = Grid([
  [Cell('█', Style(foreground: Color(0xFF00FF00))), Cell(' ', Style.empty)],
  [Cell(' ', Style.empty), Cell('█', Style(foreground: Color(0xFF00FF00)))],
]);

Properties and Settings

Property Type Description
tiles List<List<Cell>> A 2D list of cells representing rows and columns.
Inheritance

Constructors

Grid(List<List<Cell>> tiles)
Creates a new Grid with the given tiles.

Properties

hashCode int
The hash code for this object.
no setterinherited
key Key?
The optional key for this widget.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tiles List<List<Cell>>
A 2D list of cells representing rows and columns.
final

Methods

createElement() Element
Creates an Element to manage this widget's location in the tree.
inherited
getIntrinsicHeight(int width) int
Computes the intrinsic height of this widget under the given width constraint.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(Buffer buffer, Rect area) → void
Renders the widget onto the provided buffer within the specified area.
override
toString() String
A string representation of this object.
inherited

Operators

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