PlTree class

A hierarchy, opened one branch at a time.

It takes its nodes as data rather than as children, which is the opposite of what most of this library does and is the right way round here for one reason: a tree is recursive, and recursion written in widgets is a widget every caller has to write for themselves. PlTable takes its columns the same way and for the same reason.

The keyboard is the tree pattern and it is most of what makes this a tree rather than a nested column: one tab stop for the whole thing, the up and down arrows walking the rows that are actually visible, and the left and right arrows opening a branch, stepping into it, and going back out to the parent. A tree where Tab walked four hundred rows would be one nobody reaches the end of.

PlTree(
  items: nodes,
  expanded: open,
  onExpandedChanged: (Set<String> next) => setState(() => open = next),
)
Inheritance

Constructors

PlTree({required List<PlTreeNode> items, Set<String> expanded = const <String>{}, ValueChanged<Set<String>>? onExpandedChanged, Set<String> selected = const <String>{}, ValueChanged<Set<String>>? onSelectedChanged, PlTreeSelection selection = PlTreeSelection.single, ValueChanged<PlTreeNode>? onItemPressed, PlassSize? size, PlassColor? color, PlassDensity? density, String? semanticLabel, Key? key})
Creates a tree.
const

Properties

color PlassColor?
The family a selected row takes.
final
density PlassDensity?
A row's vertical padding, and nothing else.
final
expanded Set<String>
The ids of the branches that are open.
final
hashCode int
The hash code for this object.
no setterinherited
items List<PlTreeNode>
The whole tree, as data.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onExpandedChanged ValueChanged<Set<String>>?
Called with the whole open set after a branch is opened or closed.
final
onItemPressed ValueChanged<PlTreeNode>?
Called when a row is pressed, selectable or not.
final
onSelectedChanged ValueChanged<Set<String>>?
Called with the whole selection after a row is pressed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selected Set<String>
The ids of the selected rows.
final
selection PlTreeSelection
How many rows a press can leave selected.
final
semanticLabel String?
The name a screen reader gives the whole tree.
final
size PlassSize?
Row height, indent and type scale.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<PlTree>
Creates the mutable state for this widget at a given location in the tree.
override
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