Skip to content

Commit c2204ec

Browse files
committed
Added the WorkflowViewNode class.
1 parent acfbbaf commit c2204ec

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

lib/dart_comfy_frontend.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ export 'src/workflow/input.dart' show WorkflowInput;
99
export 'src/workflow/output.dart' show WorkflowOutput;
1010
export 'src/workflow/model.dart' show WorkflowModel;
1111
export 'src/workflow/view.dart' show WorkflowView;
12+
export 'src/workflow/view/node.dart' show WorkflowViewNode;

lib/src/workflow.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,14 @@ class Workflow{
4242
version
4343
);
4444
}
45+
46+
Workflow.fromEmpty() :
47+
lastNodeId = 0,
48+
lastLinkId = 0,
49+
nodes = <WorkflowNode>[],
50+
links = <dynamic>{},
51+
groups = <dynamic>[],
52+
config = {},
53+
extra = {},
54+
version = '0.0.1';
4555
}

lib/src/workflow/view.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
2-
import '../workflow/model.dart';
2+
import 'model.dart';
3+
import 'view/node.dart';
34

45
class WorkflowView extends StatelessWidget {
56

@@ -12,7 +13,7 @@ class WorkflowView extends StatelessWidget {
1213
return Column(
1314
children: [
1415
Stack(
15-
children: workflow.nodes.map<Text>((item) => Text(item.type)).toList()
16+
children: workflow.nodes.map<WorkflowViewNode>((item) => WorkflowViewNode(item)).toList()
1617
),
1718
TextButton(
1819
onPressed: () => workflow.loadExample(),

lib/src/workflow/view/node.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import 'package:flutter/material.dart';
2+
import '../node.dart';
3+
4+
class WorkflowViewNode extends StatelessWidget {
5+
const WorkflowViewNode(this.node, {super.key});
6+
7+
final WorkflowNode node;
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
return Padding(
12+
padding: const EdgeInsets.all(8.0),
13+
child: Text(node.type),
14+
);
15+
}
16+
}

0 commit comments

Comments
 (0)