Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add desktop type-to-search for Auth

StDestiny81c0e213294e
diff --git a/mobile/apps/auth/lib/ui/home_page.dart b/mobile/apps/auth/lib/ui/home_page.dart
index b8f8f04bbb..e4f7ba8798 100644
--- a/mobile/apps/auth/lib/ui/home_page.dart
+++ b/mobile/apps/auth/lib/ui/home_page.dart
@@ -1147,6 +1147,34 @@ class _HomePageState extends State<HomePage> {
return true;
}
+ // On desktop, typing a printable character opens search with that input.
+ if (PlatformDetector.isDesktop() &&
+ !isHomeSearchFocused &&
+ !isMetaKeyPressed &&
+ !pressed.contains(LogicalKeyboardKey.altLeft) &&
+ !pressed.contains(LogicalKeyboardKey.alt) &&
+ !pressed.contains(LogicalKeyboardKey.altRight) &&
+ event.character != null &&
+ event.character!.trim().isNotEmpty) {
+ final String searchStarter = event.character!;
+ setState(() {
+ _showSearchBox = true;
+ });
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (!mounted) return;
+ searchBoxFocusNode.requestFocus();
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (!mounted) return;
+ _searchText = searchStarter;
+ _textController.value = TextEditingValue(
+ text: searchStarter,
+ selection: TextSelection.collapsed(offset: searchStarter.length),
+ );
+ });
+ });
+ return true;
+ }
+
// Only use Escape for the HomePage search UI.
if (event.logicalKey == LogicalKeyboardKey.escape && _showSearchBox) {
setState(() {