Skip to content
Blog

Keyboard Accelerators for Flutter Desktop Apps

Add keyboard shortcuts and accelerators to your Flutter desktop app. Build professional desktop experiences with proper keyboard navigation.

Published on September 17, 2026

AI Assistant

Why Keyboard Shortcuts Matter

Desktop users expect keyboard shortcuts. Ctrl+S to save, Ctrl+Z to undo, Ctrl+F to find — these aren’t optional conveniences, they’re essential for productivity.

Flutter provides several mechanisms for handling keyboard input on desktop.

Shortcuts Widget

The simplest approach — wrap your widget tree with Shortcuts:

Shortcuts(
  shortcuts: {
    LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyS): SaveIntent(),
    LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyZ): UndoIntent(),
    LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyF): FindIntent(),
  },
  child: Actions(
    actions: {
      SaveIntent: CallbackAction<SaveIntent>(
        onInvoke: (intent) => _save(),
      ),
      UndoIntent: CallbackAction<UndoIntent>(
        onInvoke: (intent) => _undo(),
      ),
      FindIntent: CallbackAction<FindIntent>(
        onInvoke: (intent) => _openFind(),
      ),
    },
    child: MyApp(),
  ),
)

CallbackShortcuts (Simpler)

For quick-and-dirty shortcuts without the Intent pattern:

CallbackShortcuts(
  bindings: {
    const SingleActivator(LogicalKeyboardKey.keyS, control: true): _save,
    const SingleActivator(LogicalKeyboardKey.keyZ, control: true): _undo,
    const SingleActivator(LogicalKeyboardKey.keyF, control: true): _openFind,
  },
  child: MyApp(),
)

FocusNode for Context-Specific Shortcuts

Different shortcuts for different parts of the UI:

final _editorFocus = FocusNode();

Focus(
  focusNode: _editorFocus,
  child: CallbackShortcuts(
    bindings: {
      const SingleActivator(LogicalKeyboardKey.keyB, control: true): _bold,
      const SingleActivator(LogicalKeyboardKey.keyI, control: true): _italic,
    },
    child: TextEditor(),
  ),
)

For native menu bars on macOS, Windows, and Linux:

PlatformMenuBar(
  menus: [
    PlatformMenu(
      label: 'File',
      menus: [
        PlatformMenuItemGroup(members: [
          PlatformMenuItem(
            label: 'Save',
            shortcut: const SingleActivator(LogicalKeyboardKey.keyS, control: true),
            onSelected: _save,
          ),
        ]),
      ],
    ),
  ],
  child: MyApp(),
)

Best Practices

  1. Follow platform conventions — Ctrl on Windows/Linux, Cmd on macOS
  2. Show shortcuts in menus — users need to discover them
  3. Use SingleActivator — it handles platform differences automatically
  4. Provide visual feedback — highlight active states
  5. Don’t conflict with system shortcuts — check platform guidelines

Common Shortcuts to Implement

ShortcutAction
Ctrl+S / Cmd+SSave
Ctrl+Z / Cmd+ZUndo
Ctrl+Y / Cmd+Shift+ZRedo
Ctrl+F / Cmd+FFind
Ctrl+N / Cmd+NNew
Ctrl+W / Cmd+WClose tab
EscapeCancel/Close

Conclusion

Keyboard shortcuts are what separate a good desktop app from a great one. Flutter’s Shortcuts and Actions system makes implementing them straightforward. Add them early, and your desktop users will thank you.