toTextInputBindings method
Creates text input bindings that delegate to a TextInputBuffer.
This handles typing, backspace, delete, and cursor movement.
Returns handled if the buffer processed the event, ignored otherwise.
Implementation
KeyBindings toTextInputBindings({
void Function()? onInput,
}) {
return KeyBindings([
KeyBinding(
keys: {
KeyEventType.char,
KeyEventType.backspace,
KeyEventType.arrowLeft,
KeyEventType.arrowRight,
},
action: (event) {
if (handleKey(event)) {
onInput?.call();
return KeyActionResult.handled;
}
return KeyActionResult.ignored;
},
),
]);
}