manage show input

This commit is contained in:
Valentin CZERYBA 2024-12-21 19:06:37 +01:00
parent f267e3ede9
commit e4836ac4eb

View File

@ -268,6 +268,7 @@ class _MyHomePageState extends State<ListItemMenu> {
if (suggestions.isNotEmpty) { if (suggestions.isNotEmpty) {
showArrow = false; showArrow = false;
showInputSearch = false; showInputSearch = false;
showInputTag = false;
} }
}); });
} else { } else {
@ -468,6 +469,7 @@ class _MyHomePageState extends State<ListItemMenu> {
showInputSearch = showInputSearch =
true; // Optionally clear suggestions true; // Optionally clear suggestions
/// Clear the filtered posts /// Clear the filtered posts
showInputTag = true;
}); });
fetchPostsByLocation(); fetchPostsByLocation();
}, },
@ -489,6 +491,7 @@ class _MyHomePageState extends State<ListItemMenu> {
suggestions.clear(); // Optionally clear suggestions suggestions.clear(); // Optionally clear suggestions
showArrow = true; showArrow = true;
showInputSearch = true; showInputSearch = true;
showInputTag = true;
/// Clear the filted posts /// Clear the filted posts
}); });
@ -521,6 +524,7 @@ class _MyHomePageState extends State<ListItemMenu> {
suggestions.clear(); suggestions.clear();
showArrow = true; showArrow = true;
showInputSearch = true; showInputSearch = true;
showInputTag = true;
}); });
SharedPreferences prefs = SharedPreferences prefs =
await SharedPreferences.getInstance(); await SharedPreferences.getInstance();
@ -553,11 +557,7 @@ class _MyHomePageState extends State<ListItemMenu> {
icon: const Icon(Icons.clear), icon: const Icon(Icons.clear),
onPressed: () { onPressed: () {
setState(() { setState(() {
inputItem.clear(); inputTags.clear();
itemName = ''; // Reset the geographical zone state
suggestionsItem.clear();
showDateFields = true;
showArrow = true;
}); });
fetchPostsByLocation(); fetchPostsByLocation();
}, },
@ -565,17 +565,9 @@ class _MyHomePageState extends State<ListItemMenu> {
), ),
onChanged: (value) { onChanged: (value) {
if (value.isNotEmpty) { if (value.isNotEmpty) {
setState(() {
itemName = value;
searchSuggestionsByItem(value);
});
} else { } else {
setState(() { setState(() {
showDateFields = true; inputTags.clear(); // Clear the text field
showArrow = true; // Optionally clear suggestions
inputItem.clear(); // Clear the text field
itemName = ''; // Reset the geographical zone state
suggestionsItem.clear();
/// Clear the filted posts /// Clear the filted posts
}); });