Skip to content

Commit bccff00

Browse files
committed
chore: updated with better shapes and ports
1 parent 596fab5 commit bccff00

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

packages/demo/lib/src/examples/basics/node_shapes.dart

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,13 @@ class _NodeShapesExampleState extends State<NodeShapesExample> {
3131
}
3232

3333
void _addExampleNodes() {
34-
// Rectangle (default) node
34+
// Rectangle (default) node - output only
3535
final rectangleNode = Node<Map<String, dynamic>>(
3636
id: 'rectangle',
3737
type: 'Process',
3838
position: const Offset(100, 100),
3939
data: {'label': 'Rectangle\n(Default)'},
4040
size: const Size(150, 100),
41-
inputPorts: const [
42-
Port(
43-
id: 'input',
44-
name: 'In',
45-
position: PortPosition.left,
46-
offset: Offset(0, 50),
47-
),
48-
],
4941
outputPorts: const [
5042
Port(
5143
id: 'output',
@@ -56,18 +48,20 @@ class _NodeShapesExampleState extends State<NodeShapesExample> {
5648
],
5749
);
5850

59-
// Circle node
51+
// Circle node - input only, allows multiple connections
6052
final circleNode = Node<Map<String, dynamic>>(
6153
id: 'circle',
6254
type: 'Terminal',
6355
position: const Offset(300, 100),
6456
data: {'label': 'Circle\nStart/End'},
6557
size: const Size(120, 120),
6658
inputPorts: const [
67-
Port(id: 'input', name: 'In', position: PortPosition.left),
68-
],
69-
outputPorts: const [
70-
Port(id: 'output', name: 'Out', position: PortPosition.right),
59+
Port(
60+
id: 'input',
61+
name: 'In',
62+
position: PortPosition.left,
63+
multiConnections: true,
64+
),
7165
],
7266
);
7367

@@ -128,20 +122,13 @@ class _NodeShapesExampleState extends State<NodeShapesExample> {
128122
),
129123
Connection(
130124
id: 'conn-2',
131-
sourceNodeId: 'circle',
132-
sourcePortId: 'output',
133-
targetNodeId: 'diamond',
134-
targetPortId: 'input',
135-
),
136-
Connection(
137-
id: 'conn-3',
138125
sourceNodeId: 'diamond',
139126
sourcePortId: 'output-yes',
140127
targetNodeId: 'hexagon',
141128
targetPortId: 'input',
142129
),
143130
Connection(
144-
id: 'conn-4',
131+
id: 'conn-3',
145132
sourceNodeId: 'hexagon',
146133
sourcePortId: 'output',
147134
targetNodeId: 'hexagon-vertical',

0 commit comments

Comments
 (0)