CommentNode<T> class
A comment/sticky note node that can be placed anywhere on the canvas.
Comment nodes are free-floating elements that can be used for comments, notes, or explanations within your node flow. They support:
- Custom text content with inline editing
- Configurable size and color
- Free movement and positioning
- Resizing via drag handles
- Auto-grow height when text exceeds current bounds
Comment nodes render in the foreground layer (above regular nodes) and
do not participate in marquee selection (selectable: false).
Example
final comment = CommentNode<String>(
id: 'note-1',
position: Offset(100, 100),
text: 'This is a reminder',
data: 'optional-data',
width: 200,
height: 150,
color: Colors.yellow,
);
controller.addNode(comment);
- Inheritance
- Mixed-in types
- Available extensions
Constructors
Properties
-
allPorts
→ List<
Port> -
Gets all ports (input and output combined).
no setterinherited
- color → Color
-
The background color of the comment.
final
- currentZIndex ↔ int
-
Gets the current z-index value.
getter/setter pairinherited
- data → T
-
Custom data associated with this node.
finalinherited
-
dragging
→ Observable<
bool> -
Observable dragging state.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
The height of the comment in pixels.
no setter
- id → String
-
Unique identifier for this node.
finalinherited
-
inputPorts
→ ObservableList<
Port> -
Observable list of input ports for incoming connections.
finalinherited
- isDragging ↔ bool
-
Gets the current dragging state.
getter/setter pairinherited
- isEditing ↔ bool
-
Gets the current editing state.
getter/setter pairinherited
- isResizable → bool
-
Whether this node can be resized.
no setterinherited
- isSelected ↔ bool
-
Gets the current selection state.
getter/setter pairinherited
- isVisible ↔ bool
-
Gets the current visibility state.
getter/setter pairinherited
- layer → NodeRenderLayer
-
Rendering layer for this node.
finalinherited
- locked → bool
-
Whether this node is locked from user interactions.
finalinherited
- minSize → Size
-
Minimum size constraints for resize operations.
no setteroverride
-
outputPorts
→ ObservableList<
Port> -
Observable list of output ports for outgoing connections.
finalinherited
-
position
→ Observable<
Offset> -
Observable position of the node in graph coordinates.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectable → bool
-
Whether this node participates in marquee selection.
finalinherited
-
selected
→ Observable<
bool> -
Observable selection state.
finalinherited
-
size
→ Observable<
Size> -
Observable size of the node.
finalinherited
- text ↔ String
-
The text content displayed in the comment.
getter/setter pair
- type → String
-
Type classification for this node.
finalinherited
-
visualPosition
→ Observable<
Offset> -
Observable visual position for rendering (may include snap-to-grid).
finalinherited
- width → double
-
The width of the comment in pixels.
no setter
-
zIndex
→ Observable<
int> -
Observable z-index for stacking order.
finalinherited
Methods
-
addInputPort(
Port port) → void -
Adds an input port to the node.
inherited
-
addOutputPort(
Port port) → void -
Adds an output port to the node.
inherited
-
buildWidget(
BuildContext context) → Widget -
Builds the widget for this node.
override
-
containsPoint(
Offset point) → bool -
Checks if a point is within the node's rectangular bounds.
inherited
-
copyWith(
{String? id, Offset? position, String? text, T? data, double? width, double? height, Color? color, int? zIndex, bool? isVisible, bool? locked}) → CommentNode< T> - Creates a copy of this comment node with optional property overrides.
-
dispose(
) → void -
Disposes of resources used by this node.
inherited
-
findPort(
String portId) → Port? -
Finds a port by ID in either input or output ports.
inherited
-
getBounds(
) → Rect -
Gets the node's bounding rectangle.
inherited
-
getConnectionPoint(
String portId, {required Size portSize, NodeShape? shape}) → Offset -
Available on Node<
Gets the connection attachment point for a port in graph coordinates.T> , provided by the NodePortGeometry extension -
getPortCapsuleSide(
String portId) → CapsuleFlatSide -
Available on Node<
Gets the capsule flat side orientation for a port.T> , provided by the NodePortGeometry extension -
getPortCenter(
String portId, {required Size portSize, NodeShape? shape}) → Offset -
Available on Node<
Gets the visual center of a port in graph coordinates.T> , provided by the NodePortGeometry extension -
getVisualPortOrigin(
String portId, {required Size portSize, NodeShape? shape}) → Offset -
Available on Node<
Gets the visual position where a port should be rendered within the node container.T> , provided by the NodePortGeometry extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDragEnd(
) → void -
Called when a drag operation ends.
inherited
-
onDragMove(
Offset delta, NodeDragContext context) → void -
Called during a drag operation as the node moves.
inherited
-
onDragStart(
NodeDragContext context) → void -
Called when a drag operation starts on this node.
inherited
-
removeInputPort(
String portId) → bool -
Removes an input port by ID.
inherited
-
removeOutputPort(
String portId) → bool -
Removes an output port by ID.
inherited
-
removePort(
String portId) → bool -
Removes a port by ID from either input or output ports.
inherited
-
resize(
ResizeHandle handle, Offset delta) → void -
Applies a resize operation based on the handle being dragged.
inherited
-
setSize(
Size newSize) → void -
Sets the size of this node.
override
-
setVisualPosition(
Offset snappedPosition) → void -
Updates the visual position based on the actual position and snapping rules.
inherited
-
toJson(
Object? toJsonT(T value)) → Map< String, dynamic> -
Converts this comment node to a JSON map.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateInputPort(
String portId, Port updatedPort) → bool -
Updates an existing input port by ID.
inherited
-
updateOutputPort(
String portId, Port updatedPort) → bool -
Updates an existing output port by ID.
inherited
-
updatePort(
String portId, Port updatedPort) → bool -
Updates a port by ID in either input or output ports.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromJsonMap<
R> (Map< String, dynamic> json, R fromJsonT(Object? json)) → CommentNode<R> - Creates a CommentNode from a JSON map.