TreeViewItem class

The item used by TreeView to render tiles

See also:

Mixed in types

Constructors

TreeViewItem({Key? key, Widget? leading, required Widget content, dynamic value, List<TreeViewItem> children = const [], bool collapsable = true, bool? expanded, bool? selected = false, TreeViewItemInvoked? onInvoked, TreeViewItemOnExpandToggle? onExpandToggle, Map<Type, GestureRecognizerFactory<GestureRecognizer>> gestures = const {}, ButtonState<Color>? backgroundColor, bool autofocus = false, FocusNode? focusNode, String? semanticLabel, Widget? loadingWidget, bool lazy = false})
Creates a tree view item.
TreeViewItem.from(TreeViewItem source)
Deep copy constructor that can be used to copy an item and all of its child items. Useful if you want to have multiple trees with the same items, but with different UX states (e.g., selection, visibility, etc.).
factory

Properties

autofocus bool
True if this widget will be selected as the initial focus when no other node in its scope is currently focused.
final
backgroundColor ButtonState<Color>?
The background color of this item.
final
children List<TreeViewItem>
The children of this item.
final
collapsable bool
Whether the item can be collapsable by user-input or not.
final
content Widget
The item content
final
depth int
Indicates how far from the root node this child node is.
no setter
expanded bool
Whether the current item is expanded.
getter/setter pair
focusNode FocusNode
An optional focus node to use as the focus node for this widget.
final
gestures Map<Type, GestureRecognizerFactory<GestureRecognizer>>
The gestures that this item will respond to.
final
hashCode int
The hash code for this object.
no setteroverride
isExpandable bool
Whether this node is expandable
no setter
key Key?
final
lastParent TreeViewItem
Gets the last parent in the tree, in decrescent order.
no setter
lazy bool
Whether this item children is loaded lazily
final
leading Widget?
The item leading
final
loading bool
Whether the tree view item is loading
getter/setter pair
loadingWidget Widget?
Widget to show when loading
final
onExpandToggle TreeViewItemOnExpandToggle?
Called when this item's expansion state is toggled.
final
onInvoked TreeViewItemInvoked?
Called when this item is invoked
final
parent TreeViewItem?
TreeViewItem that owns the children collection that this node is part of.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selected bool?
Whether the current item is selected.
getter/setter pair
semanticLabel String?
Semantic label for the input.
final
value → dynamic
An optional/arbitrary value associated with the item.
final

Methods

debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
executeForAllParents(ValueChanged<TreeViewItem?> callback) → void
Executes callback for every parent found in the tree
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setSelectionStateForMultiSelectionMode(bool newSelectionState, bool deselectParentWhenChildrenDeselected) → void
Changes the selection state for this item and all of its children to either all selected or all deselected. Also appropriately updates the selection state of this item's parents as required. This should not be used for an item that belongs to a TreeView in single selection mode. See also TreeView.deselectParentWhenChildrenDeselected.
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
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited
updateSelected(bool deselectParentWhenChildrenDeselected) → void
Updates selected based on the direct childrens' state. selected will not be forced to false if deselectParentWhenChildrenDeselected is false and either there are no children or all children are deselected.

Operators

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