Node<T> constructor
Node<T> ({
- required String id,
- required String type,
- required Offset position,
- required T data,
- Size? size,
- List<
Port> inputPorts = const [], - List<
Port> outputPorts = const [], - int initialZIndex = 0,
- bool visible = true,
- NodeRenderLayer layer = NodeRenderLayer.middle,
- bool locked = false,
- bool selectable = true,
Creates a new node with the specified properties.
Parameters:
id- Unique identifier for this nodetype- Type classification for the node (e.g., 'input', 'processor', 'output')position- Initial position in the graph coordinate spacedata- Custom data associated with this nodesize- Optional size, defaults to 150x100 if not specifiedinputPorts- List of input ports for incoming connectionsoutputPorts- List of output ports for outgoing connectionsinitialZIndex- Initial stacking order, higher values appear on topvisible- Initial visibility state, defaults to truelayer- Rendering layer (background/middle/foreground), defaults to middlelocked- Whether the node is locked (cannot be dragged), defaults to falseselectable- Whether the node participates in marquee selection, defaults to true
Implementation
Node({
required this.id,
required this.type,
required Offset position,
required this.data,
Size? size,
List<Port> inputPorts = const [],
List<Port> outputPorts = const [],
int initialZIndex = 0,
bool visible = true,
this.layer = NodeRenderLayer.middle,
this.locked = false,
this.selectable = true,
}) : size = Observable(size ?? const Size(150, 100)),
position = Observable(position),
visualPosition = Observable(position),
zIndex = Observable(initialZIndex),
selected = Observable(false),
dragging = Observable(false),
_isVisible = Observable(visible),
_isEditing = Observable(false),
inputPorts = ObservableList.of(inputPorts),
outputPorts = ObservableList.of(outputPorts);