CommandItem constructor
const
CommandItem({
- Key? key,
- Widget? leading,
- required Widget title,
- Widget? trailing,
- VoidCallback? onTap,
Creates a CommandItem for display in a command palette.
Parameters:
title(Widget, required): The main label for this commandleading(Widget?, optional): Widget displayed before the title (e.g., icon)trailing(Widget?, optional): Widget displayed after the title (e.g., shortcut)onTap(VoidCallback?, optional): Callback when the item is selected
Example:
CommandItem(
leading: Icon(Icons.file_copy),
title: Text('Duplicate'),
trailing: Text('Ctrl+D'),
onTap: () => duplicate(),
)
Implementation
const CommandItem({
super.key,
this.leading,
required this.title,
this.trailing,
this.onTap,
});