Skip to content

Commit

Permalink
TF-3002 [MOBILE] Allow search when empty string query in search input
Browse files Browse the repository at this point in the history
  • Loading branch information
dab246 committed Oct 3, 2024
1 parent 5737872 commit 03768f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -747,22 +747,24 @@ class SearchEmailController extends BaseController
}

void onTextSearchSubmitted(BuildContext context, String text) {
final query = text.trim();
if (query.isNotEmpty) {
saveRecentSearch(RecentSearch.now(query));
submitSearchAction(context, query);
if (text.trim().isNotEmpty) {
saveRecentSearch(RecentSearch.now(text.trim()));
}
submitSearchAction(context, text);
}

void setTextInputSearchForm(String value) {
textInputSearchController.text = value;
}

void clearAllTextInputSearchForm() {
void clearAllTextInputSearchForm({bool requestFocus = false}) {
textInputSearchController.clear();
currentSearchText.value = '';
listSuggestionSearch.clear();
listContactSuggestionSearch.clear();
if (requestFocus) {
textInputSearchFocus.requestFocus();
}
}

void clearAllResultSearch() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class SearchEmailView extends GetWidget<SearchEmailController>
height: 18,
fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).clearAll,
onTap: controller.clearAllTextInputSearchForm);
onTap: () => controller.clearAllTextInputSearchForm(requestFocus: true));
} else {
return const SizedBox.shrink();
}
Expand Down

0 comments on commit 03768f8

Please sign in to comment.