sai_nodes 0.1.0
sai_nodes: ^0.1.0 copied to clipboard
A lightweight, scalable, and highly customizable package for building interactive node-based UIs in Flutter.
SAI Nodes #
๐ A Fully Customizable Node-Based Editor for Flutter #
SAI Nodes is a lightweight, scalable, and highly customizable Flutter package for building interactive, node-based user interfaces.
Whether you're building tools for developers, designers, or end-users, SAI Nodes provides the building blocks for:
๐ก Use Cases #
-
๐ฎ Visual Scripting Editors โ Game logic, automation flows, or state machines.
-
๐ Workflow & Process Designers โ Business rules, decision trees, and automation paths.
-
๐จ Shader & Material Graphs โ Build custom shaders visually.
-
๐ Dataflow Tools โ ETL pipelines, AI workflows, or processing graphs.
-
๐ค ML Architecture Visualizers โ Visualize and configure neural networks.
-
๐ Modular Audio Systems โ Synthesizers, effect chains, or sequencing tools.
-
๐ง Graph-Based UIs โ Mind maps, dependency trees, and hierarchical structures.
๐ Features #
-
โ Customizable UI โ Fully override widgets, ports, fields, and layout logic.
-
๐พ Pluggable Storage โ Save/load projects through JSON with full control over serialization.
-
โก Optimized Performance โ Hardware-accelerated rendering, efficient hit testing, and rebuild minimization.
-
๐ Flexible Graph System โ Directional edges, typed ports, data links, control links, and more.
-
๐ Scalable Architecture โ Suitable for lightweight diagrams and complex editors.
-
๐ Localization Support โ Easily adapt node-based UIs to multiple languages.
-
๐จ Lightweight & Elegant โ Minimal dependencies, styling hooks, and a compact public API.
-
๐ก๏ธ Reliable Controller โ Safe project resets, invalid endpoint handling, stale-selection cleanup, and duplicate-link protection.
๐ Roadmap #
The package is being developed as a reusable foundation for workflow, shader, and dataflow editors. Here's what's next:
โ๏ธ Performance Enhancements #
- Static Branch Precomputation โ Improve runtime by detecting and collapsing static branches in execution graphs.
๐ Documentation Improvements #
-
Expanded API documentation and usage examples.
-
Guides for building workflow, shader, audio, and dataflow tools.
๐ General-Purpose Flexibility #
-
๐ค Node Configuration State Machine โ Dynamically add or remove ports and fields on nodes at runtime, allowing node structure to adapt to current links and input data.
-
๐งโ๐คโ๐ง Node Grouping โ Select multiple nodes and group them together for easier organization within complex graphs.
-
โป๏ธ Reusable Graph Macros โ Define, save, and reuse templates made up of multiple nodes.
-
๐ฉ Enhanced Editor Mode โ Add advanced, opt-in editing tools and productivity shortcuts.
๐ธ Preview #
๐ Quickstart Guide #
For a fast start, follow the installation and usage examples below. More complete examples will be added as the editor API grows.
๐ฆ Installation #
To add SAI Nodes to your Flutter project, include it in your pubspec.yaml:
dependencies:
sai_nodes: ^0.1.0
Then, run:
flutter pub get
๐ ๏ธ Usage #
Import the package in your Dart file:
import 'package:sai_nodes/sai_nodes.dart';
Create a controller and add the editor to your widget tree:
final controller = NodeEditorController();
NodeEditorWidget(
controller: controller,
expandToParent: true,
overlay: () => const <OverlayData>[],
);
The package declares its grid shader as a package resource. The consuming application does not need to redeclare it:
flutter:
uses-material-design: true
For custom graphs, register NodePrototype instances with typed data or control ports and provide field, header, port, node, or context-menu builders as needed.
Generic editor extensions #
NodeEditorWidget.nodeEditorMenuBuilder enables the built-in searchable and collapsible canvas menu:
NodeEditorWidget(
controller: controller,
overlay: () => const <OverlayData>[],
nodeEditorMenuBuilder: (context, position) => [
const NodeEditorMenuAction(label: 'Create node'),
const NodeEditorMenuDivider(),
NodeEditorMenuSection(
label: 'View',
entries: [
NodeEditorMenuAction(
label: 'Reset zoom',
onSelected: controller.resetViewport,
),
],
),
],
);
Use nodeMenuBuilder for the same menu surface on individual nodes.
Both builders return NodeEditorMenuEntry values, including actions, dividers,
and nested sections. With the menu focused, Up/Down moves between enabled
actions and Enter activates the highlighted action.
The legacy editorContextMenuBuilder remains available for applications that
need flutter_context_menu entries. Set NodeEditorConfig.enableNodeResize to
show the built-in resize handle, or use NodeResizeBuilder for an
application-specific handle. Node instance titles and fixed sizes are available
as NodeDataModel.customTitle and NodeDataModel.customSize, and are included
in node JSON. For links, prefer sourceNodeId, sourcePortId, targetNodeId,
and targetPortId on FromTo; the historical tuple fields are kept for
compatibility.
๐งฉ Examples & Demo #
Explore the repository for the package source, tests, and current integration examples:
- ๐ Source repository
- ๐งช Controller regression tests
๐น๏ธ Current Input Support #
Legend:
- โ Supported
- โ Unsupported
- โ ๏ธ Partial
- ๐งช Untested
| ๐ฅ๏ธ Desktop and ๐ป laptop | Windows | Linux | macOS |
|---|---|---|---|
| native/mouse | โ | โ | โ |
| native/trackpad | โ | โ ๏ธ | โ |
| web/mouse | โ | โ | โ |
| web/trackpad | โ ๏ธ | โ ๏ธ | โ ๏ธ |
| ๐ฑ Mobile | Android | iOS |
|---|---|---|
| native | โ | ๐งช |
| web | โ | ๐งช |
๐ License #
SAI Nodes is open-source and released under the MIT License. Contributions are welcome!
๐ Contributing #
We'd love your help in making SAI Nodes even better! You can contribute by:
-
๐ก Suggesting new features
-
๐ Reporting bugs
-
๐ง Submitting pull requests
-
๐ Sharing what you've built
Feel free to file an issue or contribute directly on GitHub.
๐ Let's Build Together! #
Enjoy using SAI Nodes and create amazing node-based UIs for your Flutter apps! ๐