indexed<Data> static method
TreeView<Data, IndexedTreeNode<Data> >
indexed<Data>({
- Key? key,
- required TreeNodeWidgetBuilder<
IndexedTreeNode< builder,Data> > - required IndexedTreeNode<
Data> tree, - ExpansionBehavior expansionBehavior = ExpansionBehavior.none,
- Indentation? indentation,
- AutoScrollController? scrollController,
- ExpansionIndicatorBuilder? expansionIndicatorBuilder,
- ValueSetter<
IndexedTreeNode< ? onItemTap,Data> > - bool? primary,
- ScrollPhysics? physics,
- EdgeInsetsGeometry? padding,
- bool shrinkWrap = false,
- bool showRootNode = true,
- bool focusToNewNode = true,
- TreeReadyCallback<
Data, IndexedTreeNode< ? onTreeReady,Data> > - Animation<
double> ? animation,
The alternate implementation of TreeView uses an IndexedNode internally, which is based on the List data structure for maintaining the children states. The IndexedNode allows indexed based operations like insertion and removal of items at index positions. This allows for movement, addition and removal of child nodes based on indices.
The complexity for accessing child nodes in TreeView.indexed is simply O(node_level ^ children).
** See code in example/lib/samples/treeview/treeview_indexed_modification_sample.dart **
See also:
- If you do not require index based operations, then use the more performant and efficient TreeView.simple instead.
- For using an object that extends the IndexedTreeNode instead of using
IndexedTreeNode directly, used the TreeView.indexTyped which allows
for typed objects to be returned in the
builder
Implementation
static TreeView<Data, IndexedTreeNode<Data>> indexed<Data>({
Key? key,
required TreeNodeWidgetBuilder<IndexedTreeNode<Data>> builder,
required final IndexedTreeNode<Data> tree,
ExpansionBehavior expansionBehavior = ExpansionBehavior.none,
Indentation? indentation,
AutoScrollController? scrollController,
ExpansionIndicatorBuilder? expansionIndicatorBuilder,
ValueSetter<IndexedTreeNode<Data>>? onItemTap,
bool? primary,
ScrollPhysics? physics,
EdgeInsetsGeometry? padding,
bool shrinkWrap = false,
bool showRootNode = true,
bool focusToNewNode = true,
TreeReadyCallback<Data, IndexedTreeNode<Data>>? onTreeReady,
Animation<double>? animation,
}) =>
TreeView._(
key: key,
builder: builder,
tree: tree,
expansionBehavior: expansionBehavior,
indentation: indentation,
expansionIndicatorBuilder:
expansionIndicatorBuilder ?? _defExpansionIndicatorBuilder,
scrollController: scrollController,
onItemTap: onItemTap,
primary: primary,
physics: physics,
padding: padding,
shrinkWrap: shrinkWrap,
showRootNode: showRootNode,
onTreeReady: onTreeReady,
focusToNewNode: focusToNewNode,
animation: animation,
);