toggle static method

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

Creates toggle binding (Space).

Implementation

static KeyBindings toggle({
  required void Function() onToggle,
  String hintLabel = 'Space',
  String hintDescription = 'toggle',
}) {
  return KeyBindings([
    KeyBinding.single(
      KeyEventType.space,
      (event) {
        onToggle();
        return KeyActionResult.handled;
      },
      hintLabel: hintLabel,
      hintDescription: hintDescription,
    ),
  ]);
}