add suggestion itemé

This commit is contained in:
2024-12-22 22:11:20 +01:00
parent ba8db9fb4c
commit 03f3e1c55b
2 changed files with 183 additions and 188 deletions

View File

@@ -44,6 +44,7 @@ class _MyHomePageState extends State<ListItemMenu> {
List<Events> filteredPosts = [];
String geographicalZone = '';
String itemName = '';
String itemTags = '';
String query = '';
List<Map<String, dynamic>> suggestions = [];
List<Map<String, dynamic>> suggestionsItem = [];
@@ -376,8 +377,9 @@ class _MyHomePageState extends State<ListItemMenu> {
suggestionsTags = (data as List)
.map((feature) => {'name': feature['name']})
.toList();
if (suggestionsItem.isNotEmpty) {
showDateFields = false;
if (suggestionsTags.isNotEmpty) {
showInputGeo = false;
showInputSearch = false;
showArrow = false;
}
});
@@ -602,6 +604,33 @@ class _MyHomePageState extends State<ListItemMenu> {
fetchPostsByLocation();
}
}),
if (suggestionsTags.isNotEmpty)
Container(
height: 200,
decoration: BoxDecoration(
border: Border.all(color: Colors.blue),
borderRadius: BorderRadius.circular(8),
),
child: ListView.builder(
shrinkWrap: true,
itemCount: suggestions.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(suggestionsTags[index]['name']),
onTap: () async {
setState(() {
itemTags = suggestionsTags[index]['name'];
inputTags.text = itemTags;
suggestionsTags.clear();
showArrow = true;
showInputSearch = true;
showInputGeo = true;
});
},
);
},
),
),
],
),
);