TreeView<T> constructor

const TreeView<T>({
  1. Key? key,
  2. required List<TreeNode<T>> nodes,
  3. dynamic onSelectionChanged(
    1. List<T?>
    )?,
  4. ThemeData? theme,
  5. bool showSelectAll = false,
  6. Widget? selectAllWidget,
  7. Widget selectAllTrailing(
    1. BuildContext context
    )?,
  8. int? initialExpandedLevels,
  9. bool showExpandCollapseButton = false,
  10. dynamic customDrawNode(
    1. TreeNode<T> node,
    2. bool isSelected
    )?,
})

Creates a TreeView widget.

The nodes and onSelectionChanged parameters are required.

The theme parameter can be used to customize the appearance of the tree view.

Set showSelectAll to true to display a "Select All" checkbox.

The selectAllWidget can be used to provide a custom widget for the "Select All" functionality.

Use initialExpandedLevels to control how many levels of the tree are initially expanded. If null, no nodes are expanded. If set to 0, all nodes are expanded. If set to 1, only the root nodes are expanded, if set to 2, the root nodes and their direct children are expanded, and so on.

Set showExpandCollapseButton to true to display a button that expands or collapses all nodes.

Implementation

const TreeView({
  super.key,
  required this.nodes,
  this.onSelectionChanged,
  this.theme,
  this.showSelectAll = false,
  this.selectAllWidget,
  this.selectAllTrailing,
  this.initialExpandedLevels,
  this.showExpandCollapseButton = false,
  this.customDrawNode,
});