AnnotatedRegionLayer<T extends Object> class
Null safety
A composited layer which annotates its children with a value. Pushing this layer to the tree is the common way of adding an annotation.
An annotation is an optional object of any type that, when attached with a layer, can be retrieved using Layer.find or Layer.findAllAnnotations with a position. The search process is done recursively, controlled by a concept of being opaque to a type of annotation, explained in the document of Layer.findAnnotations.
When an annotation search arrives, this layer defers the same search to each of this layer's children, respecting their opacity. Then it adds this layer's annotation if all of the following restrictions are met:
- The target type must be identical to the annotated type
T
. - If size is provided, the target position must be contained within the rectangle formed by size and offset.
This layer is opaque to a type of annotation if any child is also opaque, or if opaque is true and the layer's annotation is added.
- Inheritance
-
- Object
- AbstractNode
- Layer
- ContainerLayer
- AnnotatedRegionLayer
Constructors
- AnnotatedRegionLayer(T value, {Size? size, Offset? offset, bool opaque = false})
- Creates a new layer that annotates its children with value.
Properties
- alwaysNeedsAddToScene → bool
- Subclasses may override this to true to disable retained rendering.
- attached → bool
-
Whether this node is in a tree whose root is attached to something.
read-onlyinherited
- debugCreator ↔ Object?
-
The object responsible for creating this layer.
read / writeinherited
- debugDisposed → bool
-
If asserts are enabled, returns whether dispose has
been called since the last time any retained resources were created.
read-onlyinherited
- debugHandleCount → int
-
Returns the number of objects holding a LayerHandle to this layer.
read-onlyinherited
- debugSubtreeNeedsAddToScene → bool?
- Whether this or any descendant layer in the subtree needs addToScene.
- depth → int
-
The depth of this node in the tree.
read-onlyinherited
- engineLayer ↔ EngineLayer?
-
Stores the engine layer created for this layer in order to reuse engine
resources across frames for better app performance.
protected">@protectedprotected">@protectedvisibleForTesting">@visibleForTestingvisibleForTesting">@visibleForTestingread / writeinherited
- firstChild → Layer?
-
The first composited layer in this layer's child list.
read-onlyinherited
- hasChildren → bool
-
Returns whether this layer has at least one child layer.
read-onlyinherited
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- lastChild → Layer?
-
The last composited layer in this layer's child list.
read-onlyinherited
- nextSibling → Layer?
-
This layer's next sibling in the parent layer's child list.
read-onlyinherited
- offset → Offset
-
The position of the annotated object.
final
- opaque → bool
-
Whether the annotation of this layer should be opaque during an annotation
search of type
T
, preventing siblings visually behind it from being searched.final - owner → Object?
-
The owner for this node (null if unattached).
read-onlyinherited
- parent → ContainerLayer?
-
This layer's parent in the layer tree.
read-onlyinherited
- previousSibling → Layer?
-
This layer's previous sibling in the parent layer's child list.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- size → Size?
-
The size of the annotated object.
final
- subtreeHasCompositionCallbacks → bool
-
Whether the subtree rooted at this layer has any composition callback
observers.
read-onlyinherited
- value → T
-
The annotated object, which is added to the result if all restrictions are
met.
final
Methods
-
addChildrenToScene(
SceneBuilder builder) → void -
Uploads all of this layer's children to the engine.
inherited
-
addCompositionCallback(
CompositionCallback callback) → VoidCallback -
Adds a callback for when the layer tree that this layer is part of gets
composited, or when it is detached and will not be rendered again.
inherited
-
addToScene(
SceneBuilder builder) → void -
Override this method to upload this layer to the engine.
inherited
-
adoptChild(
covariant Layer child) → void -
Mark the given node as being a child of this node.
inherited
-
append(
Layer child) → void -
Adds the given layer to the end of this layer's child list.
inherited
-
applyTransform(
Layer? child, Matrix4 transform) → void -
Applies the transform that would be applied when compositing the given
child to the given matrix.
inherited
-
attach(
covariant Object owner) → void -
Mark this node as attached to the given owner.
inherited
-
buildScene(
SceneBuilder builder) → Scene -
Consider this layer as the root and build a scene (a tree of layers)
in the engine.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
debugMarkClean(
) → void -
Mark that this layer is in sync with engine.
visibleForTesting">@visibleForTestinginherited
-
depthFirstIterateChildren(
) → List< Layer> -
Returns the descendants of this layer in depth first order.
visibleForTesting">@visibleForTestinginherited
-
describeClipBounds(
) → Rect? -
Describes the clip that would be applied to contents of this layer,
if any.
inherited
-
detach(
) → void -
Mark this node as detached.
inherited
-
dispose(
) → void -
Clears any retained resources that this layer holds.
inherited
-
dropChild(
covariant Layer child) → void -
Disconnect the given node from this node.
inherited
-
find<
S extends Object> (Offset localPosition) → S? -
Search this layer and its subtree for the first annotation of type
S
under the point described bylocalPosition
.inherited -
findAllAnnotations<
S extends Object> (Offset localPosition) → AnnotationResult< S> -
Search this layer and its subtree for all annotations of type
S
under the point described bylocalPosition
.inherited -
findAnnotations<
S extends Object> (AnnotationResult< S> result, Offset localPosition, {required bool onlyFirst}) → bool -
Searches the subtree for annotations of type
S
at the locationlocalPosition
, then adds the annotation value if applicable.override -
markNeedsAddToScene(
) → void - Mark that this layer has changed and addToScene needs to be called.
-
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">@protectedinherited -
redepthChildren(
) → void -
Adjust the depth of this node's children, if any.
inherited
-
remove(
) → void -
Removes this layer from its parent layer's child list.
mustCallSuper">@mustCallSuperinherited
-
removeAllChildren(
) → void -
Removes all of this layer's children from its child list.
inherited
-
supportsRasterization(
) → bool -
Whether or not this layer, or any child layers, can be rasterized with
Scene.toImage or Scene.toImageSync.
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.info}) → String -
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
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
-
updateSubtreeNeedsAddToScene(
) → void -
Traverses the layer subtree starting from this layer and determines whether it needs addToScene.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited