TreeView<T> class
A collapsible tree view that renders hierarchical data.
Uses roots as the top-level nodes and getChildren to traverse deeper. Each node is built by builder. The TreeController manages expand/collapse state.
- Inheritance
-
- Object
- Widget
- StatefulWidget
- TreeView
Constructors
-
TreeView({Key? key, required List<
T> roots, required Widget builder(T node, int depth, bool isExpanded), required List<T> getChildren(T node), required Object nodeKey(T node), bool isExpandable(T node)?, TreeController? controller, FocusNode? focusNode, void onNodeSelected(T node)?}) -
Creates a TreeView with the given
roots,builder, and traversal callbacks.const
Properties
- builder → Widget Function(T node, int depth, bool isExpanded)
-
Builds the visual representation for each node at the given
depth.final - controller → TreeController?
-
An optional external controller for expand/collapse state.
final
- focusNode → FocusNode?
-
An optional focus node for keyboard navigation.
final
-
getChildren
→ List<
T> Function(T node) -
Returns the child nodes of the given
node.final - hashCode → int
-
The hash code for this object.
no setterinherited
- isExpandable → bool Function(T node)?
-
An optional predicate that returns whether
nodecan be expanded.final - key → Key?
-
Controls how one widget replaces another in the tree.
finalinherited
- nodeKey → Object Function(T node)
-
Returns a unique key identifying
node.final - onNodeSelected → void Function(T node)?
-
Called when the user activates a node.
final
-
roots
→ List<
T> -
The top-level tree nodes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates the Element for this widget.
inherited
-
createState(
) → State< TreeView< T> > -
Creates the mutable state for this widget.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited