Skip to content

Commit

Permalink
[auth] Activate search on cmd+f on mac instead of ctrl+f
Browse files Browse the repository at this point in the history
  • Loading branch information
ua741 committed Jan 3, 2025
1 parent 7cbc5ff commit acb898e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions auth/lib/ui/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,18 @@ class _HomePageState extends State<HomePage> {
bool _handleKeyEvent(KeyEvent event) {
if (event is KeyDownEvent) {
_pressedKeys.add(event.logicalKey);
if ((_pressedKeys.contains(LogicalKeyboardKey.controlLeft) ||
bool isMetaKeyPressed = Platform.isMacOS || Platform.isIOS
? (_pressedKeys.contains(LogicalKeyboardKey.metaLeft) ||
_pressedKeys.contains(LogicalKeyboardKey.meta) ||
_pressedKeys.contains(LogicalKeyboardKey.metaRight))
: (_pressedKeys.contains(LogicalKeyboardKey.controlLeft) ||
_pressedKeys.contains(LogicalKeyboardKey.control) ||
_pressedKeys.contains(LogicalKeyboardKey.controlRight)) &&
event.logicalKey == LogicalKeyboardKey.keyF) {
_pressedKeys.contains(LogicalKeyboardKey.controlRight));

if (isMetaKeyPressed && event.logicalKey == LogicalKeyboardKey.keyF) {
setState(() {
_showSearchBox = true;
searchBoxFocusNode.requestFocus();
_textController.clear();
_searchText = "";
});
return true;
}
Expand Down

0 comments on commit acb898e

Please sign in to comment.