TF-3911 Support keyboard shortcut actions ESC to unfocus search input on web

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-07-29 03:45:51 +07:00
committed by Dat H. Pham
parent 226f6520a7
commit f169ff5feb
5 changed files with 164 additions and 81 deletions
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:tmail_ui_user/features/base/extensions/logical_key_set_helper.dart';
import 'package:tmail_ui_user/features/base/shortcut/mail/mail_list_action_shortcut_type.dart';
import 'package:tmail_ui_user/features/base/shortcut/mail/mail_view_action_shortcut_type.dart';
import 'package:tmail_ui_user/features/base/shortcut/search/search_action_shortcut_type.dart';
class AppShortcutManager {
static MailViewActionShortcutType? getMailViewActionFromEvent(KeyEvent event) {
@@ -42,4 +43,14 @@ class AppShortcutManager {
return null;
}
}
static SearchActionShortcutType? getSearchActionFromEvent(KeyEvent event) {
final keysPressed = HardwareKeyboard.instance.logicalKeysPressed;
log('AppShortcutManager::getSearchActionFromEvent: Keys pressed: $keysPressed');
if (keysPressed.isOnly(LogicalKeyboardKey.escape)) {
return SearchActionShortcutType.unFocus;
} else {
return null;
}
}
}
@@ -0,0 +1,4 @@
enum SearchActionShortcutType {
unFocus;
}