VooNodeCanvas class

A node-based canvas widget for creating visual node graphs.

This widget provides an infinite canvas where users can:

  • Place and drag nodes
  • Connect nodes via input/output ports
  • Pan and zoom the canvas
  • Select and delete nodes and connections
  • Group nodes together with Ctrl/Cmd+G

Example usage:

final controller = CanvasController();

VooNodeCanvas(
  controller: controller,
  config: const CanvasConfig(
    gridSize: 20,
    snapToGrid: true,
  ),
  onNodeMoved: (nodeId, position) {
    print('Node $nodeId moved to $position');
  },
  onConnectionCreated: (connection) {
    print('Connection created: ${connection.id}');
  },
)
Inheritance

Constructors

VooNodeCanvas({required CanvasController controller, CanvasConfig config = const CanvasConfig(), void onNodeTap(CanvasNode)?, void onNodeMoved(String nodeId, Offset newPosition)?, void onNodeDragStart(String nodeId)?, void onNodeDragEnd(String nodeId)?, void onConnectionCreated(NodeConnection)?, void onConnectionRemoved(String nodeId)?, void onConnectionTap(NodeConnection)?, VoidCallback? onCanvasTap, void onViewportChanged(Offset offset, double zoom)?, void onGroupTap(NodeGroup)?, void onGroupMoved(String nodeId)?, Key? key})
Creates a node canvas widget.
const

Properties

config → CanvasConfig
Configuration options for the canvas.
final
controller → CanvasController
The controller managing canvas state.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onCanvasTap → VoidCallback?
Called when the canvas background is tapped.
final
onConnectionCreated → void Function(NodeConnection)?
Called when a new connection is created.
final
onConnectionRemoved → void Function(String nodeId)?
Called when a connection is removed.
final
onConnectionTap → void Function(NodeConnection)?
Called when a connection is tapped.
final
onGroupMoved → void Function(String nodeId)?
Called when a group is moved (drag completed).
final
onGroupTap → void Function(NodeGroup)?
Called when a group is tapped.
final
onNodeDragEnd → void Function(String nodeId)?
Called when a node drag ends.
final
onNodeDragStart → void Function(String nodeId)?
Called when a node drag starts.
final
onNodeMoved → void Function(String nodeId, Offset newPosition)?
Called when a node is moved to a new position.
final
onNodeTap → void Function(CanvasNode)?
Called when a node is tapped.
final
onViewportChanged → void Function(Offset offset, double zoom)?
Called when the viewport changes (pan/zoom).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<VooNodeCanvas>
Creates the mutable state for this widget at a given location in the tree.
override
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