Palette class

A managed, ordered collection of named Paints.

A Palette always holds at least one paint: the default, reached via paint. Additional paints may be registered with add, each with its own offset and priority, letting a single node configure any number of paints.

Constructors

Palette({Paint? paint})

Properties

entries Iterable<PaletteEntry>
All registered paints, including the default, in ascending priority order. Includes disabled paints.
no setter
hashCode int
The hash code for this object.
no setterinherited
paint Paint
The default paint. Always present.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(PaletteEntry entry) PaletteEntry
Registers entry in the palette.
draw(Canvas canvas, Painter painter) → void
Calls painter once per enabled paint, in ascending priority order, with canvas translated to that entry's offset and back again.
entry([String? name]) PaletteEntry
The entry registered under name, or the default entry if null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String name) bool
Removes the paint named name.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String name) Paint
The paint registered under name.