more detail for a event
This commit is contained in:
parent
1118a3c100
commit
a2cc6baa80
@ -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 {
|
Future<void> _updateEvent(BuildContext context) async {
|
||||||
var url = Uri.parse("${globals.api}/token");
|
var url = Uri.parse("${globals.api}/token");
|
||||||
var name = inputName.text;
|
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();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
var accessToken = prefs.getString("access_token") ?? "";
|
var accessToken = prefs.getString("access_token") ?? "";
|
||||||
List<String> send = ["toto"];
|
List<String> send = ["toto"];
|
||||||
@ -108,11 +129,15 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
body: jsonEncode({
|
body: jsonEncode({
|
||||||
'name': name,
|
'name': name,
|
||||||
'place': place,
|
'place': place,
|
||||||
'start_date': widget.events["start_date"],
|
'start_date': startDate,
|
||||||
'end_date': widget.events['end_date'],
|
'end_date': endDate,
|
||||||
|
'zip_code': zipCode,
|
||||||
|
'country': country,
|
||||||
|
'city': city,
|
||||||
'organizers': send,
|
'organizers': send,
|
||||||
'latitude': '0.0',
|
'latitude': '0.0',
|
||||||
'longitude': '0.0',
|
'longitude': '0.0',
|
||||||
|
'description': description
|
||||||
}));
|
}));
|
||||||
print(responsePut.statusCode);
|
print(responsePut.statusCode);
|
||||||
if ((responsePut.statusCode == 200) ||
|
if ((responsePut.statusCode == 200) ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user