From 4d2dcdf2625fe629346b0865ba2d8c0ee5c386a5 Mon Sep 17 00:00:00 2001 From: dab246 Date: Wed, 14 Aug 2024 19:21:48 +0700 Subject: [PATCH] Fix cannot click advanced search --- .../quick_search/quick_search_input_form.dart | 33 ++-- .../advanced_search_filter_overlay.dart | 55 +++---- .../widgets/search_input_form_widget.dart | 141 +++++++++--------- 3 files changed, 119 insertions(+), 110 deletions(-) diff --git a/core/lib/presentation/views/quick_search/quick_search_input_form.dart b/core/lib/presentation/views/quick_search/quick_search_input_form.dart index 508c57b2c6..49dd4b4566 100644 --- a/core/lib/presentation/views/quick_search/quick_search_input_form.dart +++ b/core/lib/presentation/views/quick_search/quick_search_input_form.dart @@ -1224,21 +1224,24 @@ class _SuggestionsListState extends State<_SuggestionsList> final listAction = Wrap( children: widget.listActionButton!.map((dynamic action) { if (widget.actionButtonBuilder != null) { - return Padding( - padding: EdgeInsets.only( - right: widget.isDirectionRTL ? 0 : 8, - left: widget.isDirectionRTL ? 8 : 0, - bottom: kIsWeb ? 8 : 0 - ), - child: InkWell( - borderRadius: const BorderRadius.all(Radius.circular(10)), - onTap: () { - if (widget.buttonActionCallback != null) { - widget.buttonActionCallback!(action); - invalidateSuggestions(); - } - }, - child: widget.actionButtonBuilder!(context, action), + return Semantics( + excludeSemantics: true, + child: Padding( + padding: EdgeInsets.only( + right: widget.isDirectionRTL ? 0 : 8, + left: widget.isDirectionRTL ? 8 : 0, + bottom: kIsWeb ? 8 : 0 + ), + child: InkWell( + borderRadius: const BorderRadius.all(Radius.circular(10)), + onTap: () { + if (widget.buttonActionCallback != null) { + widget.buttonActionCallback!(action); + invalidateSuggestions(); + } + }, + child: widget.actionButtonBuilder!(context, action), + ), ), ); } else { diff --git a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_overlay.dart b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_overlay.dart index e997a8c114..5e9f801f16 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_overlay.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_filter_overlay.dart @@ -10,32 +10,35 @@ class AdvancedSearchFilterOverlay extends StatelessWidget { @override Widget build(BuildContext context) { - return PointerInterceptor( - child: GestureDetector( - onTap: () => FocusManager.instance.primaryFocus?.unfocus(), - child: Container( - constraints: BoxConstraints( - maxHeight: _getHeightOverlay(context), - ), - margin: const EdgeInsetsDirectional.only(top: 4, bottom: 16, end: 22), - padding: const EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - boxShadow: const [ - BoxShadow( - color: AppColor.colorShadowComposer, - blurRadius: 32, - offset: Offset.zero), - BoxShadow( - color: AppColor.colorDropShadow, - blurRadius: 4, - offset: Offset.zero), - ] - ), - child: SingleChildScrollView( - padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 24), - child: AdvancedSearchInputForm(), + return Semantics( + excludeSemantics: true, + child: PointerInterceptor( + child: GestureDetector( + onTap: () => FocusManager.instance.primaryFocus?.unfocus(), + child: Container( + constraints: BoxConstraints( + maxHeight: _getHeightOverlay(context), + ), + margin: const EdgeInsetsDirectional.only(top: 4, bottom: 16, end: 22), + padding: const EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: const [ + BoxShadow( + color: AppColor.colorShadowComposer, + blurRadius: 32, + offset: Offset.zero), + BoxShadow( + color: AppColor.colorDropShadow, + blurRadius: 4, + offset: Offset.zero), + ] + ), + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 24), + child: AdvancedSearchInputForm(), + ), ), ), ), diff --git a/lib/features/mailbox_dashboard/presentation/widgets/search_input_form_widget.dart b/lib/features/mailbox_dashboard/presentation/widgets/search_input_form_widget.dart index d8463069d6..595b73cfa3 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/search_input_form_widget.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/search_input_form_widget.dart @@ -35,82 +35,85 @@ class SearchInputFormWidget extends StatelessWidget with AppLoaderMixin { @override Widget build(BuildContext context) { return Obx(() { - return PortalTarget( - visible: _searchController.isAdvancedSearchViewOpen.isTrue, - portalFollower: PointerInterceptor( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: _searchController.closeAdvanceSearch - ), - ), + return Semantics( + excludeSemantics: true, child: PortalTarget( visible: _searchController.isAdvancedSearchViewOpen.isTrue, - anchor: const Aligned( - follower: Alignment.topRight, - target: Alignment.bottomRight, - widthFactor: 1, - backup: Aligned( + portalFollower: PointerInterceptor( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: _searchController.closeAdvanceSearch + ), + ), + child: PortalTarget( + visible: _searchController.isAdvancedSearchViewOpen.isTrue, + anchor: const Aligned( follower: Alignment.topRight, target: Alignment.bottomRight, widthFactor: 1, + backup: Aligned( + follower: Alignment.topRight, + target: Alignment.bottomRight, + widthFactor: 1, + ), ), - ), - portalFollower: const AdvancedSearchFilterOverlay(), - child: QuickSearchInputForm( - maxHeight: 52, - suggestionsBoxVerticalOffset: 0.0, - textFieldConfiguration: _createConfiguration(context), - suggestionsBoxDecoration: const QuickSearchSuggestionsBoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(16)), - ), - debounceDuration: const Duration(milliseconds: 300), - listActionButton: QuickSearchFilter.values, - actionButtonBuilder: (context, filterAction) { - if (filterAction is QuickSearchFilter && filterAction != QuickSearchFilter.sortBy) { - return buildListButtonForQuickSearchForm(context, filterAction); - } else { - return const SizedBox.shrink(); - } - }, - buttonActionCallback: (filterAction) { - if (filterAction is QuickSearchFilter) { - _dashBoardController.addFilterToSuggestionForm(filterAction); - } - }, - listActionPadding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 6), - titleHeaderRecent: Padding( - padding: const EdgeInsets.only(left: 12, right: 12, bottom: 8, top: 12), - child: Text( - AppLocalizations.of(context).recent, - style: const TextStyle( - fontSize: 13.0, - color: AppColor.colorTextButtonHeaderThread, - fontWeight: FontWeight.w500 + portalFollower: const AdvancedSearchFilterOverlay(), + child: QuickSearchInputForm( + maxHeight: 52, + suggestionsBoxVerticalOffset: 0.0, + textFieldConfiguration: _createConfiguration(context), + suggestionsBoxDecoration: const QuickSearchSuggestionsBoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(16)), + ), + debounceDuration: const Duration(milliseconds: 300), + listActionButton: QuickSearchFilter.values, + actionButtonBuilder: (context, filterAction) { + if (filterAction is QuickSearchFilter && filterAction != QuickSearchFilter.sortBy) { + return buildListButtonForQuickSearchForm(context, filterAction); + } else { + return const SizedBox.shrink(); + } + }, + buttonActionCallback: (filterAction) { + if (filterAction is QuickSearchFilter) { + _dashBoardController.addFilterToSuggestionForm(filterAction); + } + }, + listActionPadding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 6), + titleHeaderRecent: Padding( + padding: const EdgeInsets.only(left: 12, right: 12, bottom: 8, top: 12), + child: Text( + AppLocalizations.of(context).recent, + style: const TextStyle( + fontSize: 13.0, + color: AppColor.colorTextButtonHeaderThread, + fontWeight: FontWeight.w500 + ) ) - ) - ), - buttonShowAllResult: (context, keyword) { - if (keyword is String) { - return _buildShowAllResultButton(context, keyword); - } else { - return const SizedBox.shrink(); - } - }, - loadingBuilder: (context) => Padding( - padding: const EdgeInsets.only(bottom: 16), - child: loadingWidget - ), - fetchRecentActionCallback: _searchController.getAllRecentSearchAction, - itemRecentBuilder: (context, recent) => RecentSearchItemTileWidget(recent), - onRecentSelected: (recent) => _invokeSelectRecentItem(context, recent), - suggestionsCallback: _dashBoardController.quickSearchEmails, - itemBuilder: (context, email) => EmailQuickSearchItemTileWidget(email, _dashBoardController.selectedMailbox.value), - onSuggestionSelected: (presentationEmail) => _invokeSelectSuggestionItem(context, presentationEmail), - contactItemBuilder: (context, emailAddress) => ContactQuickSearchItem(emailAddress: emailAddress), - contactSuggestionsCallback: _dashBoardController.getContactSuggestion, - onContactSuggestionSelected: (emailAddress) => _invokeSelectContactSuggestion(context, emailAddress), - ) + ), + buttonShowAllResult: (context, keyword) { + if (keyword is String) { + return _buildShowAllResultButton(context, keyword); + } else { + return const SizedBox.shrink(); + } + }, + loadingBuilder: (context) => Padding( + padding: const EdgeInsets.only(bottom: 16), + child: loadingWidget + ), + fetchRecentActionCallback: _searchController.getAllRecentSearchAction, + itemRecentBuilder: (context, recent) => RecentSearchItemTileWidget(recent), + onRecentSelected: (recent) => _invokeSelectRecentItem(context, recent), + suggestionsCallback: _dashBoardController.quickSearchEmails, + itemBuilder: (context, email) => EmailQuickSearchItemTileWidget(email, _dashBoardController.selectedMailbox.value), + onSuggestionSelected: (presentationEmail) => _invokeSelectSuggestionItem(context, presentationEmail), + contactItemBuilder: (context, emailAddress) => ContactQuickSearchItem(emailAddress: emailAddress), + contactSuggestionsCallback: _dashBoardController.getContactSuggestion, + onContactSuggestionSelected: (emailAddress) => _invokeSelectContactSuggestion(context, emailAddress), + ) + ), ), ); });