NodesLayer<T> class

Nodes layer widget that renders all nodes with optimized reactivity.

This layer handles rendering of all nodes and wires gesture callbacks from the editor to individual NodeWidget instances.

Layer Architecture

The node flow editor uses layer-based rendering to control z-order:

Use the factory constructors to create filtered layers:

NodesLayer.background(controller, nodeBuilder, connections)  // Groups
NodesLayer.middle(controller, nodeBuilder, connections)      // Regular nodes
NodesLayer.foreground(controller, nodeBuilder, connections)  // Stickies, markers
Inheritance

Constructors

NodesLayer({Key? key, required NodeFlowController<T> controller, required Widget nodeBuilder(BuildContext context, Node<T> node), required List<Connection> connections, Widget nodeContainerBuilder(BuildContext context, Node<T> node, Widget content)?, PortBuilder<T>? portBuilder, NodeRenderLayer? layerFilter, void onNodeTap(Node<T> node)?, void onNodeDoubleTap(Node<T> node)?, void onNodeContextMenu(Node<T> node, ScreenPosition screenPosition)?, void onNodeMouseEnter(Node<T> node)?, void onNodeMouseLeave(Node<T> node)?, void onPortContextMenu(String nodeId, String portId, ScreenPosition screenPosition)?, double portSnapDistance = 8.0})
const

Properties

connections List<Connection>
final
controller NodeFlowController<T>
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
layerFilter NodeRenderLayer?
Optional filter to only render nodes in a specific layer.
final
nodeBuilder Widget Function(BuildContext context, Node<T> node)
final
nodeContainerBuilder Widget Function(BuildContext context, Node<T> node, Widget content)?
Optional builder for customizing the node container. When not provided, uses the default NodeWidget implementation.
final
onNodeContextMenu → void Function(Node<T> node, ScreenPosition screenPosition)?
Callback invoked when a node is right-clicked (context menu). The screenPosition is in screen/global coordinates for menu positioning.
final
onNodeDoubleTap → void Function(Node<T> node)?
Callback invoked when a node is double-tapped.
final
onNodeMouseEnter → void Function(Node<T> node)?
Callback invoked when mouse enters a node.
final
onNodeMouseLeave → void Function(Node<T> node)?
Callback invoked when mouse leaves a node.
final
onNodeTap → void Function(Node<T> node)?
Callback invoked when a node is tapped.
final
onPortContextMenu → void Function(String nodeId, String portId, ScreenPosition screenPosition)?
Callback invoked when a port is right-clicked (context menu). The screenPosition is in screen/global coordinates for menu positioning.
final
portBuilder PortBuilder<T>?
Optional builder for customizing individual port widgets. When not provided, uses the default PortWidget implementation.
final
portSnapDistance double
Distance around ports that expands the hit area for easier targeting.
final
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

Operators

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

Static Methods

background<T>(NodeFlowController<T> controller, Widget nodeBuilder(BuildContext context, Node<T> node), List<Connection> connections, {Widget nodeContainerBuilder(BuildContext context, Node<T> node, Widget content)?, PortBuilder<T>? portBuilder, void onNodeTap(Node<T> node)?, void onNodeDoubleTap(Node<T> node)?, void onNodeContextMenu(Node<T> node, ScreenPosition screenPosition)?, void onNodeMouseEnter(Node<T> node)?, void onNodeMouseLeave(Node<T> node)?, void onPortContextMenu(String nodeId, String portId, ScreenPosition screenPosition)?, double portSnapDistance = 8.0}) NodesLayer<T>
Creates a background nodes layer.
foreground<T>(NodeFlowController<T> controller, Widget nodeBuilder(BuildContext context, Node<T> node), List<Connection> connections, {Widget nodeContainerBuilder(BuildContext context, Node<T> node, Widget content)?, PortBuilder<T>? portBuilder, void onNodeTap(Node<T> node)?, void onNodeDoubleTap(Node<T> node)?, void onNodeContextMenu(Node<T> node, ScreenPosition screenPosition)?, void onNodeMouseEnter(Node<T> node)?, void onNodeMouseLeave(Node<T> node)?, void onPortContextMenu(String nodeId, String portId, ScreenPosition screenPosition)?, double portSnapDistance = 8.0}) NodesLayer<T>
Creates a foreground nodes layer.
middle<T>(NodeFlowController<T> controller, Widget nodeBuilder(BuildContext context, Node<T> node), List<Connection> connections, {Widget nodeContainerBuilder(BuildContext context, Node<T> node, Widget content)?, PortBuilder<T>? portBuilder, void onNodeTap(Node<T> node)?, void onNodeDoubleTap(Node<T> node)?, void onNodeContextMenu(Node<T> node, ScreenPosition screenPosition)?, void onNodeMouseEnter(Node<T> node)?, void onNodeMouseLeave(Node<T> node)?, void onPortContextMenu(String nodeId, String portId, ScreenPosition screenPosition)?, double portSnapDistance = 8.0}) NodesLayer<T>
Creates a middle nodes layer.