Compare commits

...

2 Commits

Author SHA1 Message Date
d012ac409b Merge pull request 'fix input geo search' (#24) from hotfix/inputgeo into main
Reviewed-on: #24
2024-11-28 22:32:44 +01:00
4ec4b79f2c fix input geo search 2024-11-28 22:26:12 +01:00

View File

@ -420,18 +420,34 @@ class _MyHomePageState extends State<ListItemMenu> {
setState(() {
inputGeo.clear(); // Clear the text field
geographicalZone = ''; // Reset the geographical zone state
suggestions.clear(); // Optionally clear suggestions
suggestions.clear();
showArrow = true; // Optionally clear suggestions
/// Clear the filtered posts
});
fetchPostsByLocation();
},
),
),
onChanged: (value) {
setState(() {
geographicalZone = value;
searchSuggestions(value);
});
onChanged: (value) async {
if (value.isNotEmpty) {
setState(() {
geographicalZone = value;
searchSuggestions(value);
});
} else {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.remove("city_lat");
prefs.remove("city_long");
setState(() {
inputGeo.clear(); // Clear the text field
geographicalZone = ''; // Reset the geographical zone state
suggestions.clear(); // Optionally clear suggestions
showArrow = true;
/// Clear the filted posts
});
fetchPostsByLocation();
}
},
),
if (suggestions.isNotEmpty)