Screen class abstract
A screen is the root building block in griddle
, a 2D grid of cells.
Screens are stateful, and provide a higher-level API to:
- Read and write characters and color effects to individual cells.
- Synchronize the state of the screen buffer with an external display.
There is only one provided way to create a screen:
- Screen.display, which creates a screen that uses a low-level Display.
However, Screen exists as an abstraction: extend and create your own!
- Implemented types
- Annotations
-
- @sealed
Constructors
- Screen.display(Display screen)
-
Creates a screen that interfaces with an external
screen
.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int
-
Height of the buffer.
no setterinherited
- length → int
-
Total number of cells in the buffer.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → int
-
Width of the buffer.
no setterinherited
Methods
-
clear(
[Cell cell = Cell.blank]) → void -
Fills the entire screen buffer with the attributes of the given
cell
.inherited -
fill(
{required int x, required int y, required int width, required int height, int? character, Color? foreground, Color? background}) → void -
Fills a rectangular region of the screen with the given attributes.
inherited
-
fillFrom(
Buffer other, {required int x, required int y, int sourceX = 0, int sourceY = 0, int? width, int? height}) → void -
Copies cells from
other
into the provided rectangular region.inherited -
get(
int x, int y) → Cell -
Returns the cell located at (
x
,y
).inherited -
inBounds(
int x, int y) → bool -
Returns whetyher
x
andy
are considered within bounds of the buffer.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
print(
String text, int x, int y, {Color? foreground, Color? background}) → void -
Sets character representing
text
to a particular location.inherited -
resize(
{int? width, int? height, Cell expand = Cell.blank}) → void -
Resizes the buffer to given
width
and/orheight
.inherited -
set(
int x, int y, Cell value) → void -
Sets the cell located at (
x
,y
) tovalue
.inherited -
toDebugString(
) → String -
Returns a plain-text preview of the underlying buffer.
inherited
-
toList(
) → List< Cell> -
Returns the buffer as a list of cells.
inherited
-
toMatrix(
) → List< List< Cell> > -
Returns the buffer as a nested list (2D matrix) of cells.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
) → void - Given the current state of the screen buffer, updates an external surface.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → Cell -
Returns the cell located at the specified
index
.inherited -
operator []=(
int index, Cell cell) → void -
Sets the cell located at the specified
index
tocell
.inherited