search by date work
This commit is contained in:
parent
d4f8ee2182
commit
431b8d78ad
@ -131,9 +131,8 @@ class _MyHomePageState extends State<ListItemMenu> {
|
||||
var url = Uri.parse(
|
||||
"${globals.api}/events?current_datetime=${currentDateTime.toString()}");
|
||||
if (Datepicker.text.isNotEmpty) {
|
||||
TimeOfDay time = TimeOfDay.now();
|
||||
var date = formatDate(Datepicker.text) + "T" + time.toString();
|
||||
url = Uri.parse("${globals.api}/events?date_event=${date}");
|
||||
var date = DateTime.parse(formatDate(Datepicker.text));
|
||||
url = Uri.parse("${globals.api}/events?date_event=${date.toString()}");
|
||||
}
|
||||
final response = await http.get(url, headers: {
|
||||
"Content-Type": "application/json",
|
||||
@ -317,16 +316,17 @@ class _MyHomePageState extends State<ListItemMenu> {
|
||||
double minLon = longitude - lonDistance;
|
||||
double maxLon = longitude + lonDistance;
|
||||
DateTime currentDate = DateTime.now();
|
||||
print("current_date : ${currentDate}");
|
||||
var url = Uri.parse("${globals.api}/events/search"
|
||||
"?min_lat=$minLat&max_lat=$maxLat"
|
||||
"&min_lon=$minLon&max_lon=$maxLon¤t_datetime=${currentDate.toString()}");
|
||||
if (Datepicker.text.isNotEmpty) {
|
||||
TimeOfDay time = TimeOfDay.now();
|
||||
var date = formatDate(Datepicker.text) + "T" + time.toString();
|
||||
var date = DateTime.parse(formatDate(Datepicker.text));
|
||||
print("date_event ${date.toString()}");
|
||||
url = Uri.parse("${globals.api}/events/search"
|
||||
"?min_lat=$minLat&max_lat=$maxLat"
|
||||
"&min_lon=$minLon&max_lon=$maxLon&date_event=" +
|
||||
date);
|
||||
date.toString());
|
||||
}
|
||||
|
||||
final response = await http.get(url, headers: {
|
||||
@ -390,6 +390,11 @@ class _MyHomePageState extends State<ListItemMenu> {
|
||||
setState(() {
|
||||
Datepicker.text = '';
|
||||
});
|
||||
if (inputGeo.text.isNotEmpty) {
|
||||
fetchPostsByLocation();
|
||||
} else {
|
||||
_fetchInitialData();
|
||||
}
|
||||
},
|
||||
),
|
||||
hintText: 'Recherche par date'),
|
||||
|
@ -95,7 +95,7 @@ class SearchDelegateExample extends SearchDelegate {
|
||||
String currentDate = DateTime.now().toString();
|
||||
String date = prefs.getString("date_event") ?? "";
|
||||
if (date.isNotEmpty) {
|
||||
currentDate = formatDate(date) + "T" + TimeOfDay.now().toString();
|
||||
currentDate = DateTime.parse(formatDate(date)).toString();
|
||||
parameter = "date_event";
|
||||
}
|
||||
var url = Uri.parse(
|
||||
|
Loading…
x
Reference in New Issue
Block a user