wrapper static method
Widget
wrapper({
- required List<
HuxCommandItem> commands, - required Widget child,
- String placeholder = 'Type a command or search...',
- String emptyText = 'No commands found',
- ValueChanged<
HuxCommandItem> ? onCommandSelected, - VoidCallback? onClose,
A simple widget that wraps your app and provides command palette shortcuts
Example:
HuxCommandShortcutWrapper(
commands: myCommands,
child: MaterialApp(
home: MyHomePage(),
),
)
Implementation
static Widget wrapper({
required List<HuxCommandItem> commands,
required Widget child,
String placeholder = 'Type a command or search...',
String emptyText = 'No commands found',
ValueChanged<HuxCommandItem>? onCommandSelected,
VoidCallback? onClose,
}) {
return Builder(
builder: (context) => KeyboardListener(
focusNode: FocusNode(),
onKeyEvent: handleKeyEvent(
context: context,
commands: commands,
placeholder: placeholder,
emptyText: emptyText,
onCommandSelected: onCommandSelected,
onClose: onClose,
),
child: child,
),
);
}