NodeFlowViewer<T, C> class
A simplified viewer for node flow graphs.
This widget provides a read-only view of a node flow graph. It is a wrapper around NodeFlowEditor configured with NodeFlowBehavior.preview, which allows navigation (pan, zoom, select, drag) but prevents structural changes (create, update, delete).
For full editing capabilities, use NodeFlowEditor with NodeFlowBehavior.design.
For a completely non-interactive display, use NodeFlowEditor with NodeFlowBehavior.present.
Example:
NodeFlowViewer<MyData>(
controller: controller,
theme: NodeFlowTheme.light,
nodeBuilder: (context, node) {
return Text(node.data.toString());
},
onNodeTap: (node) {
print('Tapped: ${node?.id}');
},
)
For convenience, you can also use NodeFlowViewer.withData to create a viewer with pre-loaded data:
NodeFlowViewer.withData<MyData>(
theme: NodeFlowTheme.light,
nodeBuilder: (context, node) => MyNodeWidget(node: node),
nodes: myNodesMap,
connections: myConnectionsList,
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- NodeFlowViewer
Constructors
-
NodeFlowViewer({Key? key, required NodeFlowController<
T, C> controller, required Widget nodeBuilder(BuildContext context, Node<T> node), required NodeFlowTheme theme, ValueChanged<Node< ? onNodeTap, ValueChanged<T> ?>Node< ? onNodeSelected, ValueChanged<T> ?>Connection< ? onConnectionTap, ValueChanged<C> ?>Connection< ? onConnectionSelected})C> ?> -
const
Properties
-
controller
→ NodeFlowController<
T, C> -
The controller managing the node flow state.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
nodeBuilder
→ Widget Function(BuildContext context, Node<
T> node) -
Builder function for rendering node content.
final
-
onConnectionSelected
→ ValueChanged<
Connection< ?C> ?> -
Called when a connection's selection state changes.
final
-
onConnectionTap
→ ValueChanged<
Connection< ?C> ?> -
Called when a connection is tapped.
final
-
onNodeSelected
→ ValueChanged<
Node< ?T> ?> -
Called when a node's selection state changes.
final
-
onNodeTap
→ ValueChanged<
Node< ?T> ?> -
Called when a node is tapped.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- theme → NodeFlowTheme
-
The theme configuration for visual styling.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
withData<
T, C> ({Key? key, required NodeFlowTheme theme, required Widget nodeBuilder(BuildContext context, Node< T> node), required Map<String, Node< nodes, required List<T> >Connection< connections, NodeFlowConfig? config, ValueChanged<C> >Node< ? onNodeTap, ValueChanged<T> ?>Node< ? onNodeSelected, ValueChanged<T> ?>Connection< ? onConnectionTap, ValueChanged<C> ?>Connection< ? onConnectionSelected, GraphViewport? initialViewport}) → NodeFlowViewer<C> ?>T, C> - Convenience factory to create a viewer with data pre-loaded.