withAnnotationLayer method

Widget withAnnotationLayer(
  1. NodeFlowController<T> controller
)

Wraps this widget with an annotation layer.

This creates a Stack with the original widget and an AnnotationLayer on top. The annotation layer is purely for rendering - interactions are handled by the main NodeFlowEditor.

Example

GridBackground()
  .withAnnotationLayer(controller)

Important Note

User interactions (clicks, drags) are handled by NodeFlowEditor, not by the annotation layer. This ensures consistent interaction behavior.

Parameters

  • controller: The node flow controller managing the annotations

Returns

A Stack containing the original widget and the annotation layer

Implementation

Widget withAnnotationLayer(NodeFlowController<T> controller) {
  return Stack(
    clipBehavior: Clip.none,
    children: [
      // Original widget (background, grid, etc.)
      this,

      // Annotation layer - purely for rendering
      AnnotationLayer<T>(controller: controller),
    ],
  );
}