verticalNavigation static method

KeyBindings verticalNavigation({
  1. required void onUp(),
  2. required void onDown(),
  3. String hintLabel = '↑/↓',
  4. String hintDescription = 'navigate',
})

Creates vertical navigation bindings (↑/↓).

Implementation

static KeyBindings verticalNavigation({
  required void Function() onUp,
  required void Function() onDown,
  String hintLabel = '↑/↓',
  String hintDescription = 'navigate',
}) {
  return KeyBindings([
    KeyBinding.single(
      KeyEventType.arrowUp,
      (event) {
        onUp();
        return KeyActionResult.handled;
      },
    ),
    KeyBinding.single(
      KeyEventType.arrowDown,
      (event) {
        onDown();
        return KeyActionResult.handled;
      },
      hintLabel: hintLabel,
      hintDescription: hintDescription,
    ),
  ]);
}