simple<Data> static method
- Key? key,
- required TreeNodeWidgetBuilder<
TreeNode< builder,Data> > - required TreeNode<
Data> tree, - ExpansionBehavior expansionBehavior = ExpansionBehavior.none,
- Indentation? indentation,
- AutoScrollController? scrollController,
- ExpansionIndicatorBuilder? expansionIndicatorBuilder,
- ValueSetter<
TreeNode< ? onItemTap,Data> > - EdgeInsetsGeometry? padding,
- bool showRootNode = true,
- bool focusToNewNode = true,
- TreeReadyCallback<
Data, TreeNode< ? onTreeReady,Data> > - Animation<
double> ? animation,
The default implementation of SliverTreeView that uses a TreeNode internally, which is based on the Map data structure for maintaining the children states. The TreeNode does not allow insertion and removal of items at index positions. This allows for more efficient insertion and retrieval of items at child nodes, as child items can be readily accessed using the map keys.
The main advantage of using a SliverTreeView over the TreeView is that it can be easily used with others slivers in a CustomScrollView, which means that you can easily implement a fancy animated list. The slivers are lazy loaded by default, so it can be easily mixed with other widgets without any loss of performance.
The complexity for accessing child nodes in SliverTreeView.simple is simply O(node_level). e.g. for path './.level1/level2', complexity is simply O(2).
** See code in example/lib/samples/sliver_treeview/sliver_treeview_sample.dart **
See also:
- For a SliverTreeView that allows for insertion and removal of items at index positions, use the alternate SliverTreeView.indexed.
- For using an object that extends the TreeNode instead of using TreeNode
directly, used the SliverTreeView.simpleTyped which allows for typed objects
to be returned in the
builder
Implementation
static SliverTreeView<Data, TreeNode<Data>> simple<Data>({
Key? key,
required TreeNodeWidgetBuilder<TreeNode<Data>> builder,
required final TreeNode<Data> tree,
ExpansionBehavior expansionBehavior = ExpansionBehavior.none,
Indentation? indentation,
AutoScrollController? scrollController,
ExpansionIndicatorBuilder? expansionIndicatorBuilder,
ValueSetter<TreeNode<Data>>? onItemTap,
EdgeInsetsGeometry? padding,
bool showRootNode = true,
bool focusToNewNode = true,
TreeReadyCallback<Data, TreeNode<Data>>? onTreeReady,
Animation<double>? animation,
}) =>
SliverTreeView._(
key: key,
builder: builder,
tree: tree,
expansionBehavior: expansionBehavior,
indentation: indentation,
expansionIndicatorBuilder:
expansionIndicatorBuilder ?? _defExpansionIndicatorBuilder,
scrollController: scrollController,
onItemTap: onItemTap,
padding: padding,
showRootNode: showRootNode,
onTreeReady: onTreeReady,
focusToNewNode: focusToNewNode,
animation: animation,
);