TF-3002 [MOBILE] Allow search when empty string query in search input

This commit is contained in:
dab246
2024-10-03 11:40:35 +07:00
committed by Dat H. Pham
parent 5d9f525728
commit 37dd5ecf45
2 changed files with 8 additions and 6 deletions
@@ -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() {
@@ -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();
}