From 6439e21f4989a1baeb932096082a1c40d3a60ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=B9i=20Trung=20Hi=E1=BA=BFu?= Date: Mon, 22 Jul 2024 12:04:07 +0700 Subject: [PATCH 1/9] TW-1923: Hide no results when search matrix ID --- lib/pages/search/search_view.dart | 4 +++- lib/pages/search/server_search_view.dart | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/pages/search/search_view.dart b/lib/pages/search/search_view.dart index ac42c1cf2e..3e9b8200c1 100644 --- a/lib/pages/search/search_view.dart +++ b/lib/pages/search/search_view.dart @@ -73,8 +73,10 @@ class SearchView extends StatelessWidget { searchController.serverSearchController.searchResultsNotifier, builder: ((context, searchResults, child) { if (searchResults is PresentationServerSideEmptySearch) { + final keyword = searchController.textEditingController.text; if (searchController.searchContactAndRecentChatController! - .recentAndContactsNotifier.value.isNotEmpty) { + .recentAndContactsNotifier.value.isNotEmpty || + (keyword.isValidMatrixId && keyword.startsWith('@'))) { return child!; } return _SearchHeader( diff --git a/lib/pages/search/server_search_view.dart b/lib/pages/search/server_search_view.dart index 07a1512202..7e2f38e6ed 100644 --- a/lib/pages/search/server_search_view.dart +++ b/lib/pages/search/server_search_view.dart @@ -28,11 +28,13 @@ class ServerSearchMessagesList extends StatelessWidget { searchController.serverSearchController.searchResultsNotifier, builder: (context, serverSearchNotifier, child) { if (serverSearchNotifier is PresentationServerSideEmptySearch) { + final keyword = searchController.textEditingController.text; if (searchController.searchContactAndRecentChatController! - .recentAndContactsNotifier.value.isNotEmpty) { - return const SizedBox.shrink(); + .recentAndContactsNotifier.value.isEmpty && + !(keyword.isValidMatrixId && keyword.startsWith('@'))) { + return child!; } - return child!; + return const SizedBox.shrink(); } if (serverSearchNotifier is PresentationServerSideSearch) { From 15a165113a717bc49b6cabe5d7435d620bb32720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=B9i=20Trung=20Hi=E1=BA=BFu?= Date: Tue, 23 Jul 2024 10:11:49 +0700 Subject: [PATCH 2/9] TW-1923: Add padding at the top of search in chat --- lib/pages/chat_search/chat_search_style.dart | 3 +++ lib/pages/chat_search/chat_search_view.dart | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/pages/chat_search/chat_search_style.dart b/lib/pages/chat_search/chat_search_style.dart index 57ec02cb77..a77b61edd6 100644 --- a/lib/pages/chat_search/chat_search_style.dart +++ b/lib/pages/chat_search/chat_search_style.dart @@ -13,6 +13,9 @@ class ChatSearchStyle { static const EdgeInsetsGeometry avatarPadding = EdgeInsetsDirectional.symmetric(horizontal: 8, vertical: 16); + static const EdgeInsetsGeometry searchAppBarPadding = + EdgeInsetsDirectional.only(top: 16.0); + static const EdgeInsetsGeometry emptyPadding = EdgeInsetsDirectional.all(16); static const double emptyGap = 128.0; diff --git a/lib/pages/chat_search/chat_search_view.dart b/lib/pages/chat_search/chat_search_view.dart index b8b05ae1cf..9b3d7260a5 100644 --- a/lib/pages/chat_search/chat_search_view.dart +++ b/lib/pages/chat_search/chat_search_view.dart @@ -46,7 +46,10 @@ class ChatSearchView extends StatelessWidget { toolbarHeight: AppConfig.toolbarHeight(context), backgroundColor: LinagoraSysColors.material().onPrimary, automaticallyImplyLeading: false, - title: _ChatSearchAppBar(controller), + title: Padding( + padding: ChatSearchStyle.searchAppBarPadding, + child: _ChatSearchAppBar(controller), + ), ), body: controller.sameTypeEventsBuilderController != null ? _TimelineSearchView( From c1810e9914f1e7a4e6b8e5c060c011620a1605eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=B9i=20Trung=20Hi=E1=BA=BFu?= Date: Tue, 23 Jul 2024 13:29:53 +0700 Subject: [PATCH 3/9] TW-1923: Write test for case when search MatrixID --- .../pages/search/server_search_view_test.dart | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 test/pages/search/server_search_view_test.dart diff --git a/test/pages/search/server_search_view_test.dart b/test/pages/search/server_search_view_test.dart new file mode 100644 index 0000000000..be65665af3 --- /dev/null +++ b/test/pages/search/server_search_view_test.dart @@ -0,0 +1,154 @@ +import 'package:fluffychat/config/localizations/localization_service.dart'; +import 'package:fluffychat/config/themes.dart'; +import 'package:fluffychat/pages/search/search.dart'; +import 'package:fluffychat/pages/search/search_contacts_and_chats_controller.dart'; +import 'package:fluffychat/pages/search/server_search_controller.dart'; +import 'package:fluffychat/pages/search/server_search_view.dart'; +import 'package:fluffychat/presentation/model/search/presentation_search.dart'; +import 'package:fluffychat/presentation/model/search/presentation_server_side_empty_search.dart'; +import 'package:fluffychat/presentation/model/search/presentation_server_side_state.dart'; +import 'package:fluffychat/utils/custom_scroll_behaviour.dart'; +import 'package:fluffychat/utils/responsive/responsive_utils.dart'; +import 'package:fluffychat/widgets/search/empty_search_widget.dart'; +import 'package:fluffychat/widgets/theme_builder.dart'; +import 'package:flutter/material.dart' hide SearchController; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_localized_locales/flutter_localized_locales.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:get_it/get_it.dart'; +import 'package:linagora_design_flutter/linagora_design_flutter.dart'; +import 'package:mockito/annotations.dart'; +import 'package:flutter_gen/gen_l10n/l10n.dart'; +import 'package:mockito/mockito.dart'; +import 'server_search_view_test.mocks.dart'; + +@GenerateNiceMocks([ + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), +]) +void main() { + late final SearchController mockSearchController; + late final ServerSearchController mockServerSearchController; + late final TextEditingController mockTextEditingController; + late final SearchContactsAndChatsController + mockSearchContactAndRecentChatController; + + setUpAll(() { + final getIt = GetIt.instance; + getIt.registerSingleton(ResponsiveUtils()); + mockSearchController = MockSearchController(); + mockServerSearchController = MockServerSearchController(); + mockTextEditingController = MockTextEditingController(); + mockSearchContactAndRecentChatController = + MockSearchContactsAndChatsController(); + }); + + Future makeTestable(WidgetTester tester) async { + await tester.pumpWidget( + ThemeBuilder( + builder: (context, themeMode, primaryColor) => MaterialApp( + locale: const Locale('en'), + scrollBehavior: CustomScrollBehavior(), + localizationsDelegates: const [ + LocaleNamesLocalizationsDelegate(), + L10n.delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + supportedLocales: LocalizationService.supportedLocales, + theme: TwakeThemes.buildTheme( + context, + Brightness.light, + primaryColor, + ), + home: Scaffold( + backgroundColor: LinagoraSysColors.material().onPrimary, + body: CustomScrollView( + physics: const ClampingScrollPhysics(), + slivers: [ + ServerSearchMessagesList( + searchController: mockSearchController, + ), + ], + ), + ), + ), + ), + ); + } + + group('[ServerSearchMessagesList] TEST', () { + group('GIVEN searchResultsNotifier is PresentationServerSideEmptySearch', + () { + testWidgets( + 'GIVEN notifier value is empty\n' + 'AND recentAndContactsNotifier value is empty\n' + 'AND keyword is a Matrix ID\n' + 'THEN should display SizedBox.shrink\n', + (WidgetTester tester) async { + when(mockSearchController.serverSearchController) + .thenReturn(mockServerSearchController); + when(mockSearchController.textEditingController) + .thenReturn(mockTextEditingController); + when(mockSearchController.searchContactAndRecentChatController) + .thenReturn( + mockSearchContactAndRecentChatController, + ); + when(mockTextEditingController.text).thenReturn('@test:domain.com'); + when(mockServerSearchController.searchResultsNotifier).thenReturn( + ValueNotifier( + PresentationServerSideEmptySearch(), + ), + ); + when( + mockSearchContactAndRecentChatController.recentAndContactsNotifier, + ).thenReturn(ValueNotifier>([])); + + await makeTestable(tester); + + expect(find.byType(SizedBox), findsOneWidget); + + final SizedBox foundSizedBox = + tester.firstWidget(find.byType(SizedBox)); + expect(foundSizedBox.child, isNull); + expect(foundSizedBox.width, equals(0)); + expect(foundSizedBox.height, equals(0)); + }, + ); + + testWidgets( + 'GIVEN searchResultsNotifier value is empty\n' + 'AND recentAndContactsNotifier value is empty\n' + 'AND keyword is not a Matrix ID\n' + 'THEN should display EmptySearchWidget\n', + (WidgetTester tester) async { + when(mockSearchController.serverSearchController) + .thenReturn(mockServerSearchController); + when(mockSearchController.textEditingController) + .thenReturn(mockTextEditingController); + when(mockSearchController.searchContactAndRecentChatController) + .thenReturn( + mockSearchContactAndRecentChatController, + ); + when(mockTextEditingController.text).thenReturn('test'); + when(mockServerSearchController.searchResultsNotifier).thenReturn( + ValueNotifier( + PresentationServerSideEmptySearch(), + ), + ); + when( + mockSearchContactAndRecentChatController.recentAndContactsNotifier, + ).thenReturn(ValueNotifier>([])); + + await makeTestable(tester); + await tester.pumpAndSettle(); + + expect(find.byType(EmptySearchWidget), findsOneWidget); + }, + ); + }); + }); +} From 0479eda1c0bb3ae091f066ccd749882e200dda47 Mon Sep 17 00:00:00 2001 From: "khaled.njim" Date: Mon, 19 Aug 2024 17:03:48 +0100 Subject: [PATCH 4/9] TW-1923:Removed messages section when search result is empty --- lib/pages/chat_search/chat_search_style.dart | 7 +++++++ lib/pages/chat_search/chat_search_view.dart | 3 +-- lib/pages/search/search.dart | 3 +++ lib/pages/search/search_view.dart | 15 ++------------- lib/pages/search/server_search_view.dart | 3 +-- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/pages/chat_search/chat_search_style.dart b/lib/pages/chat_search/chat_search_style.dart index a77b61edd6..2014c9b0cd 100644 --- a/lib/pages/chat_search/chat_search_style.dart +++ b/lib/pages/chat_search/chat_search_style.dart @@ -1,6 +1,13 @@ +import 'package:fluffychat/di/global/get_it_initializer.dart'; +import 'package:fluffychat/utils/responsive/responsive_utils.dart'; import 'package:flutter/material.dart'; class ChatSearchStyle { + static ResponsiveUtils responsive = getIt.get(); + + static double toolbarHeight(BuildContext context) => + responsive.isMobile(context) ? 64 : 72; + static const EdgeInsetsGeometry inputPadding = EdgeInsetsDirectional.only(start: 8, top: 16, bottom: 16, end: 16); diff --git a/lib/pages/chat_search/chat_search_view.dart b/lib/pages/chat_search/chat_search_view.dart index 9b3d7260a5..1a43caa478 100644 --- a/lib/pages/chat_search/chat_search_view.dart +++ b/lib/pages/chat_search/chat_search_view.dart @@ -1,6 +1,5 @@ import 'package:collection/collection.dart'; import 'package:fluffychat/app_state/success.dart'; -import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/domain/app_state/room/timeline_search_event_state.dart'; import 'package:fluffychat/pages/chat/chat_view_style.dart'; import 'package:fluffychat/pages/chat/events/message_download_content.dart'; @@ -43,7 +42,7 @@ class ChatSearchView extends StatelessWidget { return Scaffold( backgroundColor: LinagoraSysColors.material().onPrimary, appBar: AppBar( - toolbarHeight: AppConfig.toolbarHeight(context), + toolbarHeight: ChatSearchStyle.toolbarHeight(context), backgroundColor: LinagoraSysColors.material().onPrimary, automaticallyImplyLeading: false, title: Padding( diff --git a/lib/pages/search/search.dart b/lib/pages/search/search.dart index 458e201aa5..8c74044ea3 100644 --- a/lib/pages/search/search.dart +++ b/lib/pages/search/search.dart @@ -58,6 +58,9 @@ class SearchController extends State { String get searchWord => textEditingController.text; + bool get isSearchWordUserId => + searchWord.isValidMatrixId && searchWord.startsWith('@'); + String getBodyText(Event event, String searchWord) { final senderName = event.senderFromMemoryOrFallback.calcDisplayname( i18n: MatrixLocals(L10n.of(context)!), diff --git a/lib/pages/search/search_view.dart b/lib/pages/search/search_view.dart index 3e9b8200c1..fb077dec10 100644 --- a/lib/pages/search/search_view.dart +++ b/lib/pages/search/search_view.dart @@ -13,7 +13,6 @@ import 'package:fluffychat/widgets/twake_components/twake_loading/center_loading import 'package:flutter/material.dart' hide SearchController; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:linagora_design_flutter/colors/linagora_sys_colors.dart'; -import 'package:matrix/matrix.dart'; class SearchView extends StatelessWidget { final SearchController searchController; @@ -73,17 +72,7 @@ class SearchView extends StatelessWidget { searchController.serverSearchController.searchResultsNotifier, builder: ((context, searchResults, child) { if (searchResults is PresentationServerSideEmptySearch) { - final keyword = searchController.textEditingController.text; - if (searchController.searchContactAndRecentChatController! - .recentAndContactsNotifier.value.isNotEmpty || - (keyword.isValidMatrixId && keyword.startsWith('@'))) { - return child!; - } - return _SearchHeader( - header: L10n.of(context)!.messages, - searchController: searchController, - needShowMore: false, - ); + return child!; } if (searchResults is PresentationServerSideSearch) { @@ -130,7 +119,7 @@ class SearchView extends StatelessWidget { builder: (context, contacts, emptyChild) { if (contacts.isEmpty) { final keyword = searchController.textEditingController.text; - if (keyword.isValidMatrixId && keyword.startsWith("@")) { + if (searchController.isSearchWordUserId) { return SearchExternalContactWidget( keyword: keyword, searchController: searchController, diff --git a/lib/pages/search/server_search_view.dart b/lib/pages/search/server_search_view.dart index 7e2f38e6ed..75247dff2a 100644 --- a/lib/pages/search/server_search_view.dart +++ b/lib/pages/search/server_search_view.dart @@ -28,10 +28,9 @@ class ServerSearchMessagesList extends StatelessWidget { searchController.serverSearchController.searchResultsNotifier, builder: (context, serverSearchNotifier, child) { if (serverSearchNotifier is PresentationServerSideEmptySearch) { - final keyword = searchController.textEditingController.text; if (searchController.searchContactAndRecentChatController! .recentAndContactsNotifier.value.isEmpty && - !(keyword.isValidMatrixId && keyword.startsWith('@'))) { + !(searchController.isSearchWordUserId)) { return child!; } return const SizedBox.shrink(); From b8ebcd3d363248dfe538628e465e95627e879444 Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Mon, 25 Nov 2024 10:46:31 +0700 Subject: [PATCH 5/9] TW-1923: Update padding for back icon in chat search --- lib/pages/chat_search/chat_search_style.dart | 7 +++++-- lib/pages/chat_search/chat_search_view.dart | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pages/chat_search/chat_search_style.dart b/lib/pages/chat_search/chat_search_style.dart index 2014c9b0cd..01e48718b6 100644 --- a/lib/pages/chat_search/chat_search_style.dart +++ b/lib/pages/chat_search/chat_search_style.dart @@ -20,8 +20,11 @@ class ChatSearchStyle { static const EdgeInsetsGeometry avatarPadding = EdgeInsetsDirectional.symmetric(horizontal: 8, vertical: 16); - static const EdgeInsetsGeometry searchAppBarPadding = - EdgeInsetsDirectional.only(top: 16.0); + static EdgeInsetsGeometry searchAppBarPadding(BuildContext context) => + EdgeInsetsDirectional.only( + top: responsive.isMobile(context) ? 0 : 16.0, + start: 8, + ); static const EdgeInsetsGeometry emptyPadding = EdgeInsetsDirectional.all(16); diff --git a/lib/pages/chat_search/chat_search_view.dart b/lib/pages/chat_search/chat_search_view.dart index 1a43caa478..c3f66e688e 100644 --- a/lib/pages/chat_search/chat_search_view.dart +++ b/lib/pages/chat_search/chat_search_view.dart @@ -46,7 +46,7 @@ class ChatSearchView extends StatelessWidget { backgroundColor: LinagoraSysColors.material().onPrimary, automaticallyImplyLeading: false, title: Padding( - padding: ChatSearchStyle.searchAppBarPadding, + padding: ChatSearchStyle.searchAppBarPadding(context), child: _ChatSearchAppBar(controller), ), ), From 7ccd42b6b4e0a5cab89137d7cedf1d9db3cdb176 Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Wed, 4 Dec 2024 23:49:32 +0700 Subject: [PATCH 6/9] fixup! TW-1923: Update padding for back icon in chat search --- lib/pages/chat_search/chat_search_style.dart | 9 --------- lib/pages/chat_search/chat_search_view.dart | 8 +++----- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/pages/chat_search/chat_search_style.dart b/lib/pages/chat_search/chat_search_style.dart index 01e48718b6..2faacfcfc5 100644 --- a/lib/pages/chat_search/chat_search_style.dart +++ b/lib/pages/chat_search/chat_search_style.dart @@ -5,9 +5,6 @@ import 'package:flutter/material.dart'; class ChatSearchStyle { static ResponsiveUtils responsive = getIt.get(); - static double toolbarHeight(BuildContext context) => - responsive.isMobile(context) ? 64 : 72; - static const EdgeInsetsGeometry inputPadding = EdgeInsetsDirectional.only(start: 8, top: 16, bottom: 16, end: 16); @@ -20,12 +17,6 @@ class ChatSearchStyle { static const EdgeInsetsGeometry avatarPadding = EdgeInsetsDirectional.symmetric(horizontal: 8, vertical: 16); - static EdgeInsetsGeometry searchAppBarPadding(BuildContext context) => - EdgeInsetsDirectional.only( - top: responsive.isMobile(context) ? 0 : 16.0, - start: 8, - ); - static const EdgeInsetsGeometry emptyPadding = EdgeInsetsDirectional.all(16); static const double emptyGap = 128.0; diff --git a/lib/pages/chat_search/chat_search_view.dart b/lib/pages/chat_search/chat_search_view.dart index c3f66e688e..b8b05ae1cf 100644 --- a/lib/pages/chat_search/chat_search_view.dart +++ b/lib/pages/chat_search/chat_search_view.dart @@ -1,5 +1,6 @@ import 'package:collection/collection.dart'; import 'package:fluffychat/app_state/success.dart'; +import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/domain/app_state/room/timeline_search_event_state.dart'; import 'package:fluffychat/pages/chat/chat_view_style.dart'; import 'package:fluffychat/pages/chat/events/message_download_content.dart'; @@ -42,13 +43,10 @@ class ChatSearchView extends StatelessWidget { return Scaffold( backgroundColor: LinagoraSysColors.material().onPrimary, appBar: AppBar( - toolbarHeight: ChatSearchStyle.toolbarHeight(context), + toolbarHeight: AppConfig.toolbarHeight(context), backgroundColor: LinagoraSysColors.material().onPrimary, automaticallyImplyLeading: false, - title: Padding( - padding: ChatSearchStyle.searchAppBarPadding(context), - child: _ChatSearchAppBar(controller), - ), + title: _ChatSearchAppBar(controller), ), body: controller.sameTypeEventsBuilderController != null ? _TimelineSearchView( From a22a28b61ccd3f71f093f27b118ff1b49aca281b Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Wed, 4 Dec 2024 23:50:44 +0700 Subject: [PATCH 7/9] fixup! fixup! TW-1923: Update padding for back icon in chat search --- lib/pages/chat_search/chat_search_style.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/pages/chat_search/chat_search_style.dart b/lib/pages/chat_search/chat_search_style.dart index 2faacfcfc5..57ec02cb77 100644 --- a/lib/pages/chat_search/chat_search_style.dart +++ b/lib/pages/chat_search/chat_search_style.dart @@ -1,10 +1,6 @@ -import 'package:fluffychat/di/global/get_it_initializer.dart'; -import 'package:fluffychat/utils/responsive/responsive_utils.dart'; import 'package:flutter/material.dart'; class ChatSearchStyle { - static ResponsiveUtils responsive = getIt.get(); - static const EdgeInsetsGeometry inputPadding = EdgeInsetsDirectional.only(start: 8, top: 16, bottom: 16, end: 16); From 1490b6cde86b266373c4dd25eb35b7d7f0a6fd9f Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Tue, 10 Dec 2024 15:08:57 +0700 Subject: [PATCH 8/9] fixup! fixup! fixup! TW-1923: Update padding for back icon in chat search --- .../widget/no_contacts_found.dart | 56 +------------------ 1 file changed, 3 insertions(+), 53 deletions(-) diff --git a/lib/pages/new_private_chat/widget/no_contacts_found.dart b/lib/pages/new_private_chat/widget/no_contacts_found.dart index b5baabdb6e..b5d6b495ee 100644 --- a/lib/pages/new_private_chat/widget/no_contacts_found.dart +++ b/lib/pages/new_private_chat/widget/no_contacts_found.dart @@ -10,59 +10,9 @@ class NoContactsFound extends StatelessWidget { @override Widget build(BuildContext context) { return keyword != null - ? Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - L10n.of(context)!.noResultForKeyword(keyword!), - style: Theme.of(context).textTheme.titleLarge, - ), - const SizedBox( - height: 8.0, - ), - Text.rich( - TextSpan( - style: Theme.of(context).textTheme.bodyMedium, - children: [ - TextSpan( - children: [ - TextSpan( - text: L10n.of(context)!.searchResultNotFound1, - ), - TextSpan( - text: L10n.of(context)!.searchResultNotFound2, - ), - TextSpan( - text: L10n.of(context)!.searchResultNotFound3, - ), - TextSpan( - text: L10n.of(context)!.searchResultNotFound4, - ), - TextSpan( - text: L10n.of(context)!.searchResultNotFound5, - style: Theme.of(context) - .textTheme - .bodyMedium - ?.copyWith( - color: Theme.of(context).colorScheme.primary, - ), - ), - ], - ), - ], - ), - ), - const SizedBox( - height: 8.0, - ), - const Align( - alignment: Alignment.center, - child: EmptySearchWidget(), - ), - ], - ), + ? const Align( + alignment: Alignment.center, + child: EmptySearchWidget(), ) : SizedBox( height: MediaQuery.sizeOf(context).height * 0.7, From e1bcc7c063986e037234b90700e09a6a62140325 Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Thu, 12 Dec 2024 15:37:09 +0700 Subject: [PATCH 9/9] fixup! fixup! fixup! fixup! TW-1923: Update padding for back icon in chat search --- lib/pages/search/search.dart | 2 +- lib/pages/search/search_view.dart | 2 +- lib/pages/search/server_search_view.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pages/search/search.dart b/lib/pages/search/search.dart index 8c74044ea3..9ae0ea5d7a 100644 --- a/lib/pages/search/search.dart +++ b/lib/pages/search/search.dart @@ -58,7 +58,7 @@ class SearchController extends State { String get searchWord => textEditingController.text; - bool get isSearchWordUserId => + bool get isSearchMatrixUserId => searchWord.isValidMatrixId && searchWord.startsWith('@'); String getBodyText(Event event, String searchWord) { diff --git a/lib/pages/search/search_view.dart b/lib/pages/search/search_view.dart index fb077dec10..540653481f 100644 --- a/lib/pages/search/search_view.dart +++ b/lib/pages/search/search_view.dart @@ -119,7 +119,7 @@ class SearchView extends StatelessWidget { builder: (context, contacts, emptyChild) { if (contacts.isEmpty) { final keyword = searchController.textEditingController.text; - if (searchController.isSearchWordUserId) { + if (searchController.isSearchMatrixUserId) { return SearchExternalContactWidget( keyword: keyword, searchController: searchController, diff --git a/lib/pages/search/server_search_view.dart b/lib/pages/search/server_search_view.dart index 75247dff2a..1e3f8b818e 100644 --- a/lib/pages/search/server_search_view.dart +++ b/lib/pages/search/server_search_view.dart @@ -30,7 +30,7 @@ class ServerSearchMessagesList extends StatelessWidget { if (serverSearchNotifier is PresentationServerSideEmptySearch) { if (searchController.searchContactAndRecentChatController! .recentAndContactsNotifier.value.isEmpty && - !(searchController.isSearchWordUserId)) { + !(searchController.isSearchMatrixUserId)) { return child!; } return const SizedBox.shrink();