From d793fa64a3eb0c6bbf95ca08ffa169522cf39920 Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 16 Jan 2023 20:58:42 +0800 Subject: [PATCH] dialog tab order Signed-off-by: 21pages --- flutter/lib/common.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 04d7b85d0..23aa9535d 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -613,8 +613,9 @@ class CustomAlertDialog extends StatelessWidget { Future.delayed(Duration.zero, () { if (!focusNode.hasFocus) focusNode.requestFocus(); }); - return Focus( - focusNode: focusNode, + FocusScopeNode scopeNode = FocusScopeNode(); + return FocusScope( + node: scopeNode, autofocus: true, onKey: (node, key) { if (key.logicalKey == LogicalKeyboardKey.escape) { @@ -626,6 +627,11 @@ class CustomAlertDialog extends StatelessWidget { key.logicalKey == LogicalKeyboardKey.enter) { if (key is RawKeyDownEvent) onSubmit?.call(); return KeyEventResult.handled; + } else if (key.logicalKey == LogicalKeyboardKey.tab) { + if (key is RawKeyDownEvent) { + scopeNode.nextFocus(); + } + return KeyEventResult.handled; } return KeyEventResult.ignored; },