TreeView class
Defines the TreeView widget.
This is the main widget for the package. It requires a controller and allows you to specify other optional properties that manages the appearance and handle events.
TreeView(
controller: _treeViewController,
allowParentSelect: false,
supportParentDoubleTap: false,
onExpansionChanged: _expandNodeHandler,
onNodeTap: (key) {
setState(() {
_treeViewController = _treeViewController.copyWith(selectedKey: key);
});
},
theme: treeViewTheme
),
- Inheritance
Constructors
- TreeView({Key? key, required TreeViewController controller, dynamic onNodeTap(String)?, dynamic onNodeDoubleTap(String)?, ScrollPhysics? physics, dynamic onExpansionChanged(String, bool)?, bool allowParentSelect = false, bool supportParentDoubleTap = false, bool shrinkWrap = false, bool primary = true, Widget nodeBuilder(BuildContext, Node)?, TreeViewTheme? theme})
Properties
- allowParentSelect → bool
-
Determines whether the user can select a parent node. If false,
tapping the parent will expand or collapse the node. If true, the node
will be selected and the use has to use the expander to expand or
collapse the node.
final
- child → Widget
-
The widget below this widget in the tree.
finalinherited
- controller → TreeViewController
-
The controller for the TreeView. It manages the data and selected key.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- nodeBuilder → (Widget Function(BuildContext, Node)?)
-
Custom builder for nodes. Parameters are the build context and tree node.
final
- onExpansionChanged → (dynamic Function(String, bool)?)
-
The expand/collapse handler for a node. Passes the node key and the
expansion state.
final
- onNodeDoubleTap → (dynamic Function(String)?)
-
The double tap handler for a node. Passes the node key.
final
- onNodeTap → (dynamic Function(String)?)
-
The tap handler for a node. Passes the node key.
final
- physics → ScrollPhysics?
-
How the TreeView should respond to user input.
final
- primary → bool
-
Whether the TreeView is the primary scroll widget associated with the
parent PrimaryScrollController..
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shrinkWrap → bool
-
Whether the extent of the TreeView should be determined by the contents
being viewed.
final
- supportParentDoubleTap → bool
-
Determines whether the parent node can receive a double tap. This is
useful if allowParentSelect is true. This allows the user to double tap
the parent node to expand or collapse the parent when allowParentSelect
is true.
IMPORTANT
When true, the tap handler is delayed. This is because the double tap
action requires a short delay to determine whether the user is attempting
a single or double tap.
final
- theme → TreeViewTheme
-
The theme for TreeView.
final
Methods
-
createElement(
) → InheritedElement -
Inflates this configuration to a concrete instance.
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}) → 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
-
updateShouldNotify(
covariant TreeView oldWidget) → bool -
Whether the framework should notify widgets that inherit from this widget.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → TreeView?