anyKeyToContinue static method
Creates bindings for "press any key to continue" scenarios.
This matches common navigation keys - not literally every key, but the ones users typically expect to work.
Implementation
static KeyBindings anyKeyToContinue({
void Function()? onContinue,
String hintLabel = 'any key',
String hintDescription = 'continue',
}) {
return KeyBindings([
KeyBinding.multi(
{
KeyEventType.enter,
KeyEventType.esc,
KeyEventType.space,
KeyEventType.arrowLeft,
KeyEventType.arrowRight,
KeyEventType.arrowUp,
KeyEventType.arrowDown,
KeyEventType.tab,
KeyEventType.ctrlC,
},
(event) {
onContinue?.call();
return KeyActionResult.confirmed;
},
hintLabel: hintLabel,
hintDescription: hintDescription,
),
// Also handle any character press
KeyBinding.char(
(c) => true,
(event) {
onContinue?.call();
return KeyActionResult.confirmed;
},
),
]);
}