PlinthTree class

Hierarchical navigation with expandable branches, matching Mantine's Tree.

Controlled, like the rest of the library: it owns neither which branches are open nor what is selected, and reports the set it would become. That matters more here than elsewhere — a file tree that loads children on expand, or restores its open branches between sessions, needs that state to live above the widget.

Keyboard traversal works the way a tree is expected to: arrow up/down move between visible rows (Flutter's own directional traversal, since every row is focusable), right opens a branch or steps into it, left closes it or steps out to the parent.

PlinthTree(
  nodes: _nodes,
  expanded: _expanded,
  onExpandedChanged: (e) => setState(() => _expanded = e),
  selected: _selected,
  onSelected: (v) => setState(() => _selected = v),
)
Inheritance

Constructors

PlinthTree({Key? key, required List<PlinthTreeNode> nodes, required Set<String> expanded, ValueChanged<Set<String>>? onExpandedChanged, String? selected, ValueChanged<String>? onSelected, PlinthSize size = PlinthSize.md, String? color, double indent = 20})
const

Properties

color → String?
final
expanded → Set<String>
Values of the open branches.
final
hashCode → int
The hash code for this object.
no setterinherited
indent → double
Pixels of indent per level.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
nodes → List<PlinthTreeNode>
final
onExpandedChanged → ValueChanged<Set<String>>?
Null leaves every branch fixed as given.
final
onSelected → ValueChanged<String>?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selected → String?
final
size → PlinthSize
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