TreeItemView constructor
const
TreeItemView({
- Key? key,
- required Widget child,
- Widget? leading,
- Widget? trailing,
- VoidCallback? onPressed,
- VoidCallback? onDoublePressed,
- ValueChanged<
bool> ? onExpand, - bool? expandable,
- 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 treechild
(Widget, required): Main content widget for the tree itemleading
(Widget?, optional): Widget displayed before the contenttrailing
(Widget?, optional): Widget displayed after the contentonPressed
(VoidCallback?, optional): Callback for press/click eventsonDoublePressed
(VoidCallback?, optional): Callback for double-click eventsonExpand
(ValueChangedexpandable
(bool?, optional): Whether the item can be expandedfocusNode
(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,
});