Skip to content

Commit

Permalink
Fixed shortcuts not working after interacting with dialog widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Oct 23, 2023
1 parent 38eb132 commit 0b362fd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/pages/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {
late final SharedPreferences _preferences;
late final UpdateChecker updateChecker;

late final FocusNode dashboardFocusNode;

final List<DashboardGrid> grids = [];

final List<TabData> tabData = [];
Expand All @@ -62,6 +64,8 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {
_preferences = widget.preferences;
updateChecker = UpdateChecker(currentVersion: widget.version);

dashboardFocusNode = FocusNode();

windowManager.addListener(this);
Future(() async => await windowManager.setPreventClose(true));

Expand Down Expand Up @@ -187,6 +191,7 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {

@override
void dispose() async {
dashboardFocusNode.dispose();
windowManager.removeListener(this);
super.dispose();
}
Expand Down Expand Up @@ -851,7 +856,14 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {
},
},
child: Focus(
focusNode: dashboardFocusNode,
autofocus: true,
canRequestFocus: true,
onFocusChange: (value) {
if (!value) {
dashboardFocusNode.requestFocus();
}
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expand Down

0 comments on commit 0b362fd

Please sign in to comment.