more detail for a event

This commit is contained in:
Valentin CZERYBA 2024-09-03 15:54:37 +02:00
parent 1118a3c100
commit a2cc6baa80

View File

@ -86,10 +86,31 @@ class _UpdateeventImageState extends State<UpdateeventImage>
}
}
String formatDate(String date) {
var splitedDate = date.split("-");
var day = splitedDate[0];
var month = splitedDate[1];
var year = splitedDate[2];
return "${year}-${month}-${day}";
}
Future<void> _updateEvent(BuildContext context) async {
var url = Uri.parse("${globals.api}/token");
var name = inputName.text;
var place = inputCity.text;
var place = inputAddress.text;
var city = inputCity.text;
var country = inputCountry.text;
var zipCode = inputZipCode.text;
var description = inputDesc.text;
var startDateFormat = formatDate(startDatepicker.text);
var endDateFormat = formatDate(endDatepicker.text);
var startDate =
"${startDateFormat}T${startTimepicker.text.replaceAll('-', ':')}";
var endDate = "${endDateFormat}T${endTimepicker.text.replaceAll('-', ':')}";
print("start date : ${startDate}");
print("end date : ${endDate}");
SharedPreferences prefs = await SharedPreferences.getInstance();
var accessToken = prefs.getString("access_token") ?? "";
List<String> send = ["toto"];
@ -108,11 +129,15 @@ class _UpdateeventImageState extends State<UpdateeventImage>
body: jsonEncode({
'name': name,
'place': place,
'start_date': widget.events["start_date"],
'end_date': widget.events['end_date'],
'start_date': startDate,
'end_date': endDate,
'zip_code': zipCode,
'country': country,
'city': city,
'organizers': send,
'latitude': '0.0',
'longitude': '0.0',
'description': description
}));
print(responsePut.statusCode);
if ((responsePut.statusCode == 200) ||