horizontalNavigation static method

KeyBindings horizontalNavigation({
  1. required void onLeft(),
  2. required void onRight(),
  3. String hintLabel = '←/→',
  4. String hintDescription = 'adjust',
})

Creates horizontal navigation bindings (←/→).

Implementation

static KeyBindings horizontalNavigation({
  required void Function() onLeft,
  required void Function() onRight,
  String hintLabel = '←/→',
  String hintDescription = 'adjust',
}) {
  return KeyBindings([
    KeyBinding.single(
      KeyEventType.arrowLeft,
      (event) {
        onLeft();
        return KeyActionResult.handled;
      },
    ),
    KeyBinding.single(
      KeyEventType.arrowRight,
      (event) {
        onRight();
        return KeyActionResult.handled;
      },
      hintLabel: hintLabel,
      hintDescription: hintDescription,
    ),
  ]);
}