feat: add keyboard shortcuts for notes, the note list and the app

This commit is contained in:
randogoth 2026-10-13 11:31:14 +03:00
parent ed2de5e67f
commit 722390ecec
9 changed files with 532 additions and 60 deletions

View file

@ -7,6 +7,7 @@ import 'package:permission_handler/permission_handler.dart';
import 'themes/day.dart';
import 'themes/night.dart';
import 'note_list.dart';
import 'shortcuts.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
@ -72,6 +73,15 @@ class _MuzzleVelocityAppState extends State<MuzzleVelocityApp> {
textTheme: GoogleFonts.ibmPlexMonoTextTheme(nightText),
),
themeMode: _themeMode,
// App-wide shortcuts; screens can override them with their own bindings.
builder: (context, child) => CallbackShortcuts(
bindings: {
quitShortcut: quitApp,
primaryShortcut(LogicalKeyboardKey.keyD): () =>
_toggleTheme(_themeMode != ThemeMode.dark),
},
child: child!,
),
home: NoteListScreen(
toggleTheme: _toggleTheme,
toggleTags: _toggleTags,