Grid class

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

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([
  [GridCell('█', Style(foreground: Color(0xFF00FF00))), GridCell(' ', Style.empty)],
  [GridCell(' ', Style.empty), GridCell('█', Style(foreground: Color(0xFF00FF00)))],
]);

Properties and Settings

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

Constructors

Grid(List<List<GridCell>> 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<GridCell>>
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.
override
getIntrinsicHeight(int width) → int
Computes the intrinsic height of this widget under the given width constraint.
inherited
getIntrinsicWidth(int height) → int
Computes the intrinsic width of this widget under the given height constraint.
inherited
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