OffsetLayer class

A layer that is displayed at an offset from its parent layer.

Offset layers are key to efficient repainting because they are created by repaint boundaries in the RenderObject tree (see RenderObject.isRepaintBoundary). When a render object that is a repaint boundary is asked to paint at given offset in a PaintingContext, the render object first checks whether it needs to repaint itself. If not, it reuses its existing OffsetLayer (and its entire subtree) by mutating its offset property, cutting off the paint walk.



OffsetLayer({Offset offset: })
Creates an offset layer. [...]


offset Offset
Offset from parent in the parent's coordinate system. [...]
read / write
alwaysNeedsAddToScene bool
Subclasses may override this to true to disable retained rendering.
@protected, read-only, inherited
attached bool
Whether this node is in a tree whose root is attached to something. [...]
read-only, inherited
debugCreator ↔ dynamic
The object responsible for creating this layer. [...]
read / write, inherited
debugSubtreeNeedsAddToScene bool
Whether any layer in the subtree needs addToScene. [...]
@visibleForTesting, read-only, inherited
depth int
The depth of this node in the tree. [...]
read-only, inherited
firstChild Layer
The first composited layer in this layer's child list.
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
lastChild Layer
The last composited layer in this layer's child list.
read-only, inherited
nextSibling Layer
This layer's next sibling in the parent layer's child list.
read-only, inherited
owner Object
The owner for this node (null if unattached). [...]
read-only, inherited
parent ContainerLayer
This layer's parent in the layer tree. [...]
read-only, inherited
previousSibling Layer
This layer's previous sibling in the parent layer's child list.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


addToScene(SceneBuilder builder, [ Offset layerOffset = ]) EngineLayer
Override this method to upload this layer to the engine. [...]
applyTransform(Layer child, Matrix4 transform) → void
Applies the transform that would be applied when compositing the given child to the given matrix. [...]
buildScene(SceneBuilder builder) Scene
Consider this layer as the root and build a scene (a tree of layers) in the engine.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
find<S>(Offset regionOffset) → S
Returns the value of S that corresponds to the point described by regionOffset. [...]
toImage(Rect bounds, { double pixelRatio: 1.0 }) Future<Image>
Capture an image of the current state of this layer and its children. [...]
addChildrenToScene(SceneBuilder builder, [ Offset childOffset = ]) → void
Uploads all of this layer's children to the engine. [...]
adoptChild(covariant AbstractNode child) → void
Mark the given node as being a child of this node. [...]
append(Layer child) → void
Adds the given layer to the end of this layer's child list.
attach(covariant Object owner) → void
Mark this node as attached to the given owner. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
debugMarkClean() → void
Mark that this layer is in sync with engine. [...]
@visibleForTesting, inherited
depthFirstIterateChildren() List<Layer>
Returns the descendants of this layer in depth first order.
@visibleForTesting, inherited
detach() → void
Mark this node as detached. [...]
dropChild(covariant AbstractNode child) → void
Disconnect the given node from this node. [...]
markNeedsAddToScene() → void
Mark that this layer has changed and addToScene needs to be called.
@protected, @visibleForTesting, inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
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. [...]
remove() → void
Removes this layer from its parent layer's child list. [...]
@mustCallSuper, inherited
removeAllChildren() → void
Removes all of this layer's children from its child list.
replaceWith(Layer newLayer) → void
Replaces this layer with the given layer in the parent layer's child list.
toDiagnosticsNode({String name, DiagnosticsTreeStyle style }) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this object.
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode. [...]
updateSubtreeNeedsAddToScene() → void
Traverse the layer tree and compute if any subtree needs addToScene. [...]


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