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(),
),
)
Menu Bar Integration
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
- Follow platform conventions — Ctrl on Windows/Linux, Cmd on macOS
- Show shortcuts in menus — users need to discover them
- Use
SingleActivator— it handles platform differences automatically - Provide visual feedback — highlight active states
- Don’t conflict with system shortcuts — check platform guidelines
Common Shortcuts to Implement
| Shortcut | Action |
|---|---|
| Ctrl+S / Cmd+S | Save |
| Ctrl+Z / Cmd+Z | Undo |
| Ctrl+Y / Cmd+Shift+Z | Redo |
| Ctrl+F / Cmd+F | Find |
| Ctrl+N / Cmd+N | New |
| Ctrl+W / Cmd+W | Close tab |
| Escape | Cancel/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.