NodeShape class abstract
Defines the visual shape and appearance of a node in the flow editor.
A NodeShape determines how a node appears visually by providing:
- A Path that defines the node's outline
- Port anchor points that define where ports attach to the shape
- Visual properties like fill color, stroke color, and stroke width
- Hit testing logic to determine if a point is inside the shape
This abstraction allows nodes to be rendered as various shapes like circles, diamonds, hexagons, etc., instead of just rectangles.
Shapes are typically created in the nodeContainerBuilder based on
node type or data, keeping the node model purely data-focused.
Example:
nodeContainerBuilder: (context, node) {
NodeShape? shape;
if (node.type == 'Decision') {
shape = DiamondShape(
fillColor: Colors.orange,
strokeColor: Colors.deepOrange,
strokeWidth: 2.0,
);
}
return NodeWidget(node: node, shape: shape, child: ...);
}
- Implementers
Properties
- fillColor → Color?
-
The fill color for the shape background.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strokeColor → Color?
-
The stroke (border) color for the shape outline.
final
- strokeWidth → double?
-
The stroke (border) width for the shape outline.
final
Methods
-
buildPath(
Size size) → Path - Builds the path that defines this shape's outline.
-
containsPoint(
Offset point, Size size) → bool - Checks if a point is inside this shape.
-
getBounds(
Size size) → Rect - Gets the bounding rectangle for this shape.
-
getPortAnchors(
Size size) → List< PortAnchor> - Gets the port anchor points for this shape.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited