Skip to content

Commit

Permalink
Fix cannot click advanced search
Browse files Browse the repository at this point in the history
  • Loading branch information
dab246 committed Aug 14, 2024
1 parent c34f1b4 commit 4d2dcdf
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1224,21 +1224,24 @@ class _SuggestionsListState<T, P, R> extends State<_SuggestionsList<T, P, R>>
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PresentationEmail, EmailAddress, RecentSearch>(
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<PresentationEmail, EmailAddress, RecentSearch>(
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),
)
),
),
);
});
Expand Down

0 comments on commit 4d2dcdf

Please sign in to comment.