PlTreeSelect class
A value chosen out of a hierarchy rather than out of a list.
The gap between a PlSelect and a PlTree: the first is a flat list behind a field, the second is a hierarchy that shows what it holds but has no field to put it in. A category, a folder, a region and an org chart node are all chosen from a shape a flat list flattens away.
It is the two of them composed and almost nothing else — the trigger is the shell all the pickers wear, and what is in the popup is a PlTree with a PlTextField over it. What it adds is the arithmetic between them: which nodes a query keeps, which branches that opens, and which of the ids coming back out of the tree are answers rather than roads.
PlTreeSelect(
items: regions,
value: chosen,
onValueChanged: (Set<String> next) => setState(() => chosen = next),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PlTreeSelect
Constructors
-
PlTreeSelect({required List<
PlTreeSelectNode> items, Set<String> value = const <String>{}, ValueChanged<Set< ? onValueChanged, bool multiple = false, bool selectableBranches = false, Set<String> >String> ? expanded, ValueChanged<Set< ? onExpandedChanged, bool? open, ValueChanged<String> >bool> ? onOpenChanged, Widget? placeholder, bool clearable = false, bool? closeOnSelect, bool searchable = false, String? searchLabel, String? emptyLabel, String format(List<PlTreeSelectNode> chosen)?, PlassVariant variant = PlassVariant.glass, PlassSize? size, PlassColor? color, PlassDensity? density, PlassElevation elevation = 0, Widget? label, Widget? description, Widget? error, bool? invalid, Widget? startIcon, bool fullWidth = false, bool readOnly = false, bool disabled = false, String? semanticLabel, FocusNode? focusNode, bool autofocus = false, Key? key}) -
Creates a tree select.
const
Properties
- autofocus → bool
-
Takes focus as it is inserted into the tree.
final
- clearable → bool
-
Offers the × that empties the control.
final
- closeOnSelect → bool?
-
Closes the popup as soon as a node is chosen. Defaults to
!multiple.final - color → PlassColor?
-
Semantic colour role.
final
- density → PlassDensity?
-
Horizontal padding. Never the height.
final
- description → Widget?
-
Helper text below it.
final
- disabled → bool
-
Unavailable.
final
- elevation → int
-
Drop shadow depth of the trigger.
0, like a PlTextField.final - emptyLabel → String?
-
What the popup says when the filter matched nothing.
final
- error → Widget?
-
Error message below it. Its presence also turns the picker invalid.
final
-
expanded
→ Set<
String> ? -
The ids of the branches that are open. Leave it out and the picker holds
its own.
final
- focusNode → FocusNode?
-
Drive focus from outside.
final
-
format
→ String Function(List<
PlTreeSelectNode> chosen)? -
How the trigger writes what is held. Defaults to the labels, comma-joined.
final
- fullWidth → bool
-
Stretches to the width of the container.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- invalid → bool?
-
Forces the invalid state without a message.
final
-
items
→ List<
PlTreeSelectNode> -
The whole tree, as data.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → Widget?
-
Label above the trigger.
final
- multiple → bool
-
Whether more than one node may be held at once.
final
-
onExpandedChanged
→ ValueChanged<
Set< ?String> > -
Called with the whole open set after a branch is opened or closed.
final
-
onOpenChanged
→ ValueChanged<
bool> ? -
Called when the popup should open or close.
final
-
onValueChanged
→ ValueChanged<
Set< ?String> > -
Called with the whole selection after a node is chosen or dropped.
final
- open → bool?
-
Whether the popup is up. Leave it out and the picker holds its own.
final
- placeholder → Widget?
-
Shown in the trigger while nothing is chosen.
final
- readOnly → bool
-
The value is shown but cannot be changed, and the popup does not open.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchable → bool
-
Offers a field above the tree that filters it.
final
- searchLabel → String?
-
The word in the filter field.
final
- selectableBranches → bool
-
Whether a node that has children may itself be chosen.
final
- semanticLabel → String?
-
The name a screen reader gives the trigger.
final
- size → PlassSize?
-
Height and type scale.
final
- startIcon → Widget?
-
The glyph before the value.
final
-
value
→ Set<
String> -
The ids of the chosen nodes. Controlled.
final
- variant → PlassVariant
-
What the trigger's well is cut into.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PlTreeSelect> -
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