rowToggle static method

KeyBindings rowToggle({
  1. required void onToggle(),
  2. String hintLabel = '←/→ / Space',
  3. String hintDescription = 'toggle',
})

Creates row toggle binding (←/→ or Space to toggle current row).

Used for toggle switches where horizontal arrows or space toggle the value.

Implementation

static KeyBindings rowToggle({
  required void Function() onToggle,
  String hintLabel = '←/→ / Space',
  String hintDescription = 'toggle',
}) {
  return KeyBindings([
    KeyBinding.multi(
      {KeyEventType.arrowLeft, KeyEventType.arrowRight, KeyEventType.space},
      (event) {
        onToggle();
        return KeyActionResult.handled;
      },
      hintLabel: hintLabel,
      hintDescription: hintDescription,
    ),
  ]);
}