TreeViewController class

Enables control over the TreeViewNodes of a TreeView.

It can be useful to expand or collapse nodes of the tree programmatically, for example to reconfigure an existing node based on a system event. To do so, create a TreeView with a TreeViewController that's owned by a stateful widget or look up the tree's automatically created TreeViewController with TreeViewController.of

The controller's methods to expand or collapse nodes cause the the TreeView to rebuild, so they may not be called from a build method.

Constructors

TreeViewController()
Create a controller to be used with TreeView.controller.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

collapseAll() → void
Closes all parent TreeViewNodes in the tree.
collapseNode(TreeViewNode<Object?> node) → void
Collapses the TreeViewNode that was built with this controller.
expandAll() → void
Expands all parent TreeViewNodes in the tree.
expandNode(TreeViewNode<Object?> node) → void
Expands the TreeViewNode that was built with this controller.
getActiveIndexFor(TreeViewNode<Object?> node) int?
Returns the current row index of the given TreeViewNode.
getNodeFor(Object? content) TreeViewNode<Object?>?
Returns the TreeViewNode containing the associated content, if it exists.
isActive(TreeViewNode<Object?> node) bool
Whether or not the given TreeViewNode is enclosed within its parent TreeViewNode.
isExpanded(TreeViewNode<Object?> node) bool
Whether the given TreeViewNode built with this controller is in an expanded state.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toggleNode(TreeViewNode<Object?> node) → void
Switches the given TreeViewNodes expanded state.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

maybeOf(BuildContext context) TreeViewController?
Finds the TreeView from the closest instance of this class that encloses the given context and returns its TreeViewController.
of(BuildContext context) TreeViewController
Finds the TreeViewController for the closest TreeView instance that encloses the given context.