add condition
This commit is contained in:
parent
a0ece6f973
commit
23aec689f1
@ -1,4 +1,3 @@
|
|||||||
import 'package:covas_mobile/classes/alert.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart'; // Import dotenv
|
import 'package:flutter_dotenv/flutter_dotenv.dart'; // Import dotenv
|
||||||
@ -122,6 +121,10 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
DateTime currentDateTime = DateTime.now();
|
DateTime currentDateTime = DateTime.now();
|
||||||
var url = Uri.parse(
|
var url = Uri.parse(
|
||||||
"${globals.api}/events?current_datetime=${currentDateTime.toString()}");
|
"${globals.api}/events?current_datetime=${currentDateTime.toString()}");
|
||||||
|
if (Datepicker.text.isNotEmpty) {
|
||||||
|
url = Uri.parse(
|
||||||
|
"${globals.api}/events?current_datetime=${currentDateTime.toString()}");
|
||||||
|
}
|
||||||
final response = await http.get(url, headers: {
|
final response = await http.get(url, headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
HttpHeaders.cookieHeader: "access_token=${accessToken}"
|
HttpHeaders.cookieHeader: "access_token=${accessToken}"
|
||||||
@ -307,6 +310,11 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
var url = Uri.parse("${globals.api}/events/search"
|
var url = Uri.parse("${globals.api}/events/search"
|
||||||
"?min_lat=$minLat&max_lat=$maxLat"
|
"?min_lat=$minLat&max_lat=$maxLat"
|
||||||
"&min_lon=$minLon&max_lon=$maxLon¤t_datetime=${currentDate.toString()}");
|
"&min_lon=$minLon&max_lon=$maxLon¤t_datetime=${currentDate.toString()}");
|
||||||
|
if (Datepicker.text.isNotEmpty) {
|
||||||
|
url = Uri.parse("${globals.api}/events/search"
|
||||||
|
"?min_lat=$minLat&max_lat=$maxLat"
|
||||||
|
"&min_lon=$minLon&max_lon=$maxLon");
|
||||||
|
}
|
||||||
|
|
||||||
final response = await http.get(url, headers: {
|
final response = await http.get(url, headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -343,7 +351,9 @@ class _MyHomePageState extends State<ListItemMenu> {
|
|||||||
Datepicker.text = DateFormat("dd-MM-yyyy").format(pickedDate);
|
Datepicker.text = DateFormat("dd-MM-yyyy").format(pickedDate);
|
||||||
if (inputGeo.text.isEmpty) {
|
if (inputGeo.text.isEmpty) {
|
||||||
_fetchInitialData();
|
_fetchInitialData();
|
||||||
} else {}
|
} else {
|
||||||
|
fetchPostsByLocation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Padding _BuildDateField() {
|
Padding _BuildDateField() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user