From 25feec69c07cc802d6d90d7aa02f6105dfe6d2ee Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 27 Mar 2021 18:55:23 +0100 Subject: [PATCH] fix: Start chat --- lib/views/search_view.dart | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/views/search_view.dart b/lib/views/search_view.dart index a040350f7..bad789a0b 100644 --- a/lib/views/search_view.dart +++ b/lib/views/search_view.dart @@ -357,11 +357,17 @@ class _SearchViewState extends State { itemBuilder: (BuildContext context, int i) { var foundProfile = foundProfiles[i]; return ListTile( - onTap: () { - setState(() { - _controller.text = currentSearchTerm = - foundProfile.userId.substring(1); - }); + onTap: () async { + final roomID = await showFutureLoadingDialog( + context: context, + future: () => Matrix.of(context) + .client + .startDirectChat(foundProfile.userId), + ); + if (roomID.error == null) { + await AdaptivePageLayout.of(context) + .popAndPushNamed('/rooms/${roomID.result}'); + } }, leading: Avatar( foundProfile.avatarUrl,