flow_graph 0.0.9 flow_graph: ^0.0.9 copied to clipboard
DAG graph on flutter.
Features #
- Support draggable node;
- Support delete node & edge;
- Support horizontal & vertical layout;
Getting started #
dependencies:
flow_graph: ^0.0.9
Screen shot #
Usage #
Flow graph:
FlowGraphView(
root: root,
direction: _direction,
centerLayout: _centerLayout,
builder: (context, node) {
return Container(
color: Colors.white60,
padding: const EdgeInsets.all(16),
child: Text(
node.data.toString(),
style: const TextStyle(color: Colors.black87, fontSize: 16),
),
);
},
)
Draggable flow graph:
DraggableFlowGraphView<FamilyNode>(
root: root,
direction: _direction,
centerLayout: _centerLayout,
willConnect: (node) => true,
willAccept: (node) => true,
builder: (context, node) {
return Container(
color: Colors.white60,
padding: const EdgeInsets.all(16),
child: Text(
(node.data as FamilyNode).name,
style: const TextStyle(color: Colors.black87, fontSize: 16),
),
);
},
nodeSecondaryMenuItems: (node) {
return [
PopupMenuItem(
child: Text('Delete'),
onTap: () {
setter(() {
node.deleteSelf();
});
},
)
];
},
)
License #
See LICENSE