AnnotationLayer<T> class

A rendering layer for annotations in the node flow editor.

This widget serves as a pure rendering layer that displays annotations on the canvas. It automatically:

  • Observes annotation changes via MobX for reactive updates
  • Sorts annotations by z-index for proper layering
  • Applies filtering to show specific annotation types
  • Handles selection and highlight visual feedback
  • Uses RepaintBoundary for optimized rendering

Layer Architecture

The node flow editor typically uses two annotation layers:

  1. Background layer: Renders GroupAnnotations behind nodes
  2. Foreground layer: Renders sticky notes and markers above connections

Important Note

This is a pure rendering layer. User interactions (clicks, drags, etc.) are handled by the NodeFlowEditor, not by this widget. This separation ensures consistent interaction behavior across all canvas elements.

Example Usage

// Background layer for groups
AnnotationLayer<MyNodeData>.background(controller)

// Foreground layer for stickies and markers
AnnotationLayer<MyNodeData>.foreground(controller)

// Custom filtered layer
AnnotationLayer<MyNodeData>(
  controller: controller,
  filter: (annotation) => annotation is StickyAnnotation,
)

See also:

Inheritance
Available extensions

Constructors

AnnotationLayer({Key? key, required NodeFlowController<T> controller, bool filter(Annotation)?})
Creates an annotation layer.
const

Properties

controller NodeFlowController<T>
The node flow controller managing the annotations.
final
filter bool Function(Annotation)?
Optional filter to determine which annotations to render.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
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.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
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, int wrapWidth = 65}) 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 short, textual description of this widget.
inherited
withAnnotationLayer(NodeFlowController<T> controller) Widget

Available on Widget, provided by the AnnotationLayerSupport extension

Wraps this widget with an annotation layer.

Operators

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

Static Methods

background<T>(NodeFlowController<T> controller) AnnotationLayer<T>
Creates a background annotation layer that renders only groups.
foreground<T>(NodeFlowController<T> controller) AnnotationLayer<T>
Creates a foreground annotation layer that renders everything except groups.