TreeItemView constructor

const TreeItemView({
  1. Key? key,
  2. required Widget child,
  3. Widget? leading,
  4. Widget? trailing,
  5. VoidCallback? onPressed,
  6. VoidCallback? onDoublePressed,
  7. ValueChanged<bool>? onExpand,
  8. bool? expandable,
  9. FocusNode? focusNode,
})

Creates a TreeItemView with comprehensive tree item functionality.

Configures a tree item widget with interaction support, optional expansion, and customizable leading/trailing elements.

Parameters:

  • key (Key?): Widget identifier for the widget tree
  • child (Widget, required): Main content widget for the tree item
  • leading (Widget?, optional): Widget displayed before the content
  • trailing (Widget?, optional): Widget displayed after the content
  • onPressed (VoidCallback?, optional): Callback for press/click events
  • onDoublePressed (VoidCallback?, optional): Callback for double-click events
  • onExpand (ValueChanged
  • expandable (bool?, optional): Whether the item can be expanded
  • focusNode (FocusNode?, optional): Focus node for keyboard navigation

Example:

TreeItemView(
  leading: Icon(Icons.folder),
  trailing: Badge(child: Text('3')),
  expandable: true,
  onPressed: () => handleSelection(),
  onDoublePressed: () => handleOpen(),
  onExpand: (expanded) => handleExpansion(expanded),
  child: Text('Project Folder'),
)

Implementation

const TreeItemView({
  super.key,
  required this.child,
  this.leading,
  this.trailing,
  this.onPressed,
  this.onDoublePressed,
  this.onExpand,
  this.expandable,
  this.focusNode,
});