From 0b362fd680387fd7e66228235bb0b194faebea3e Mon Sep 17 00:00:00 2001 From: Gold872 Date: Mon, 23 Oct 2023 18:59:41 -0400 Subject: [PATCH] Fixed shortcuts not working after interacting with dialog widget --- lib/pages/dashboard_page.dart | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/pages/dashboard_page.dart b/lib/pages/dashboard_page.dart index 52a106bc..cfbfbda8 100644 --- a/lib/pages/dashboard_page.dart +++ b/lib/pages/dashboard_page.dart @@ -47,6 +47,8 @@ class _DashboardPageState extends State with WindowListener { late final SharedPreferences _preferences; late final UpdateChecker updateChecker; + late final FocusNode dashboardFocusNode; + final List grids = []; final List tabData = []; @@ -62,6 +64,8 @@ class _DashboardPageState extends State with WindowListener { _preferences = widget.preferences; updateChecker = UpdateChecker(currentVersion: widget.version); + dashboardFocusNode = FocusNode(); + windowManager.addListener(this); Future(() async => await windowManager.setPreventClose(true)); @@ -187,6 +191,7 @@ class _DashboardPageState extends State with WindowListener { @override void dispose() async { + dashboardFocusNode.dispose(); windowManager.removeListener(this); super.dispose(); } @@ -851,7 +856,14 @@ class _DashboardPageState extends State with WindowListener { }, }, child: Focus( + focusNode: dashboardFocusNode, autofocus: true, + canRequestFocus: true, + onFocusChange: (value) { + if (!value) { + dashboardFocusNode.requestFocus(); + } + }, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [