recherche par tags terminé
This commit is contained in:
parent
48c785c586
commit
0df538ef46
@ -325,6 +325,10 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
stringParameter = stringParameter + "&item=${inputItem.text}";
|
stringParameter = stringParameter + "&item=${inputItem.text}";
|
||||||
endpoint = "events/search";
|
endpoint = "events/search";
|
||||||
}
|
}
|
||||||
|
if (inputTags.text.isNotEmpty) {
|
||||||
|
stringParameter = stringParameter + "&tags=${inputTags.text}";
|
||||||
|
endpoint = "events/search";
|
||||||
|
}
|
||||||
if (stringParameter.isNotEmpty) {
|
if (stringParameter.isNotEmpty) {
|
||||||
stringParameter = "$stringParameter&$dateParameter";
|
stringParameter = "$stringParameter&$dateParameter";
|
||||||
} else {
|
} else {
|
||||||
@ -370,20 +374,22 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
HttpHeaders.cookieHeader: "access_token=$accessToken"
|
HttpHeaders.cookieHeader: "access_token=$accessToken"
|
||||||
});
|
});
|
||||||
|
print("status code tags : ${response.statusCode}");
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final data = json.decode(utf8.decode(response.bodyBytes));
|
final data = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
print("tags ${data}");
|
||||||
setState(() {
|
setState(() {
|
||||||
suggestionsTags = (data as List)
|
suggestionsTags = (data as List)
|
||||||
.map((feature) => {'name': feature['name']})
|
.map((feature) => {'name': feature['name']})
|
||||||
.toList();
|
.toList();
|
||||||
|
print("suggesttion tag : ${suggestionsTags}");
|
||||||
if (suggestionsTags.isNotEmpty) {
|
if (suggestionsTags.isNotEmpty) {
|
||||||
showInputGeo = false;
|
showInputGeo = false;
|
||||||
showInputSearch = false;
|
showInputSearch = false;
|
||||||
showArrow = false;
|
showArrow = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
print("status code : ${response.statusCode}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -398,6 +404,7 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
HttpHeaders.cookieHeader: "access_token=$accessToken"
|
HttpHeaders.cookieHeader: "access_token=$accessToken"
|
||||||
});
|
});
|
||||||
|
|
||||||
print("status code : ${response.statusCode}");
|
print("status code : ${response.statusCode}");
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final List<dynamic> body = json.decode(utf8.decode(response.bodyBytes));
|
final List<dynamic> body = json.decode(utf8.decode(response.bodyBytes));
|
||||||
@ -595,9 +602,17 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
),
|
),
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (value.isNotEmpty) {
|
if (value.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
itemTags = value;
|
||||||
|
searchSuggestionsByTag(value);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
inputTags.clear(); // Clear the text field
|
inputTags.clear();
|
||||||
|
showArrow = true;
|
||||||
|
showInputSearch = true;
|
||||||
|
showInputGeo = true; // Optionally clear suggestions
|
||||||
|
itemTags = ''; // Clear the text field
|
||||||
|
|
||||||
/// Clear the filted posts
|
/// Clear the filted posts
|
||||||
});
|
});
|
||||||
@ -613,7 +628,7 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
),
|
),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: suggestions.length,
|
itemCount: suggestionsTags.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(suggestionsTags[index]['name']),
|
title: Text(suggestionsTags[index]['name']),
|
||||||
@ -626,6 +641,7 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
showInputSearch = true;
|
showInputSearch = true;
|
||||||
showInputGeo = true;
|
showInputGeo = true;
|
||||||
});
|
});
|
||||||
|
await fetchPostsByLocation();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user