Layer class

A composited layer.

During painting, the render tree generates a tree of composited layers that are uploaded into the engine and displayed by the compositor. This class is the base class for all composited layers.

Most layers can have their properties mutated, and layers can be moved to different parents. The scene must be explicitly recomposited after such changes are made; the layer tree does not maintain its own dirty state.

To composite the tree, create a SceneBuilder object, pass it to the root Layer object's addToScene method, and then call SceneBuilder.build to obtain a Scene. A Scene can then be painted using Window.render.

See also:

Inheritance
Mixed in types
Implementers

Constructors

Layer()

Properties

alwaysNeedsAddToScene bool
Subclasses may override this to true to disable retained rendering.
@protected, read-only
debugCreator ↔ dynamic
The object responsible for creating this layer. [...]
read / write
debugSubtreeNeedsAddToScene bool
Whether this or any descendant layer in the subtree needs addToScene. [...]
@visibleForTesting, read-only
engineLayer EngineLayer
Stores the engine layer created for this layer in order to reuse engine resources across frames for better app performance. [...]
@protected, read / write
nextSibling Layer
This layer's next sibling in the parent layer's child list.
read-only
parent ContainerLayer
This layer's parent in the layer tree. [...]
read-only, override
previousSibling Layer
This layer's previous sibling in the parent layer's child list.
read-only
attached bool
Whether this node is in a tree whose root is attached to something. [...]
read-only, inherited
depth int
The depth of this node in the tree. [...]
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
owner Object
The owner for this node (null if unattached). [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addToScene(SceneBuilder builder, [ Offset layerOffset = Offset.zero ]) → void
Override this method to upload this layer to the engine. [...]
@protected
adoptChild(covariant AbstractNode child) → void
Mark the given node as being a child of this node. [...]
override
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
override
debugMarkClean() → void
Mark that this layer is in sync with engine. [...]
@visibleForTesting
dropChild(covariant AbstractNode child) → void
Disconnect the given node from this node. [...]
override
find<S>(Offset regionOffset) → S
Returns the value of S that corresponds to the point described by regionOffset. [...]
findAll<S>(Offset regionOffset) Iterable<S>
Returns an iterable of S values that corresponds to the point described by regionOffset on all layers under the point. [...]
markNeedsAddToScene() → void
Mark that this layer has changed and addToScene needs to be called.
@protected, @visibleForTesting
remove() → void
Removes this layer from its parent layer's child list. [...]
@mustCallSuper
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode. [...]
override
updateSubtreeNeedsAddToScene() → void
Traverses the layer subtree starting from this layer and determines whether it needs addToScene. [...]
@protected, @visibleForTesting
attach(covariant Object owner) → void
Mark this node as attached to the given owner. [...]
@mustCallSuper, inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
inherited
detach() → void
Mark this node as detached. [...]
@mustCallSuper, inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
redepthChild(AbstractNode child) → void
Adjust the depth of the given child to be greater than this node's own depth. [...]
@protected, inherited
redepthChildren() → void
Adjust the depth of this node's children, if any. [...]
inherited
toDiagnosticsNode({String name, DiagnosticsTreeStyle style }) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this object.
inherited
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this node and its descendants. [...]
inherited
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a one-line detailed description of the object. [...]
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited