From c5620c4f69db3b27222b9017374a307e25455ded Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 24 May 2021 11:07:02 +0200 Subject: [PATCH] fix: Click on room aliases --- lib/pages/search.dart | 11 +++++++++-- lib/pages/views/search_view.dart | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/pages/search.dart b/lib/pages/search.dart index deb2ec87..171f509d 100644 --- a/lib/pages/search.dart +++ b/lib/pages/search.dart @@ -131,11 +131,18 @@ class SearchController extends State { setState(() {}); } + bool _init = false; + @override Widget build(BuildContext context) { - alias = VRouter.of(context).queryParameters['query']; - if (alias != null) genericSearchTerm ??= alias; + if (!_init) { + _init = true; + controller.text = VRouter.of(context).queryParameters['query'] ?? ''; + WidgetsBinding.instance + .addPostFrameCallback((_) => search(controller.text)); + } return SearchView(this); } } +// #fluffychat:matrix.org \ No newline at end of file diff --git a/lib/pages/views/search_view.dart b/lib/pages/views/search_view.dart index c6defcff..a0f9b5ad 100644 --- a/lib/pages/views/search_view.dart +++ b/lib/pages/views/search_view.dart @@ -62,7 +62,8 @@ class SearchView extends StatelessWidget { ); return DefaultTabController( length: 3, - initialIndex: 1, + initialIndex: + controller.controller.text?.startsWith('#') ?? false ? 0 : 1, child: Scaffold( appBar: AppBar( leading: BackButton(),