Decorator class

Decorator is an abstract class that encapsulates a particular visual effect that should apply to drawing commands wrapped by this class.

The simplest way to apply a Decorator to a component is to override its renderTree method like this:

@override
void renderTree(Canvas canvas) {
  decorator.applyChain(super.renderTree, canvas);
}

Decorators have ability to form a chain, where multiple decorators can be applied in a sequence. This chain is essentially a unary tree, or a linked list: each decorator knows only about the next decorator on the chain.

The following implementations are available:

Implementers

Constructors

Decorator()

Properties

hashCode int
The hash code for this object.
no setterinherited
isLastDecorator bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addLast(Decorator? decorator) → void
Adds a new decorator onto the chain of decorators
apply(void draw(Canvas), Canvas canvas) → void
Applies visual effect while drawing on the canvas.
applyChain(void draw(Canvas), Canvas canvas) → void
Applies this and all subsequent decorators if any.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeLast() → void
Removes the last decorator from the chain of decorators
replaceLast(Decorator? decorator) → void
toString() String
A string representation of this object.
inherited

Operators

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