fix date and orga
This commit is contained in:
parent
4de6603b91
commit
34c2b5d322
@ -65,6 +65,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
String listUser = "";
|
||||
String eventName = "";
|
||||
String eventStartDate = "";
|
||||
String organizers = "";
|
||||
|
||||
Events? events;
|
||||
@override
|
||||
@ -79,7 +80,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
var accessToken = prefs.getString("access_token") ?? "";
|
||||
String formerName = "";
|
||||
String formerDate = "";
|
||||
print("${accessToken}");
|
||||
String formerOrga = "";
|
||||
|
||||
if (accessToken.isNotEmpty) {
|
||||
var urlGet = Uri.parse("${globals.api}/events/${widget.title}");
|
||||
@ -94,7 +95,18 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
final startDate = DateTime.parse(events["start_date"]);
|
||||
final date = DateFormat.yMd().format(startDate);
|
||||
final time = DateFormat.Hm().format(startDate);
|
||||
formerDate = "${date} - ${time}";
|
||||
|
||||
final endDate = DateTime.parse(events["end_date"]);
|
||||
final dateE = DateFormat.yMd().format(endDate);
|
||||
final timeE = DateFormat.Hm().format(endDate);
|
||||
formerDate = "${date} ${time} à ${dateE} ${timeE}";
|
||||
if (events["organizers"].length > 1) {
|
||||
for (var orga in events["organizers"]) {
|
||||
formerOrga = "${formerOrga}, ${orga}";
|
||||
}
|
||||
} else {
|
||||
formerOrga = "${events['organizers'][0]}";
|
||||
}
|
||||
} else {
|
||||
var text = "";
|
||||
switch (responseGet.statusCode) {
|
||||
@ -148,6 +160,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
// called again, and so nothing would appear to happen.
|
||||
eventName = formerName;
|
||||
eventStartDate = formerDate;
|
||||
organizers = formerOrga;
|
||||
});
|
||||
}
|
||||
|
||||
@ -188,7 +201,8 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
|
||||
),
|
||||
Row(children: [
|
||||
Icon(Icons.group),
|
||||
Text("Organisateurs : ", style: TextStyle(fontSize: 15.0))
|
||||
Text("Organisateurs : ${organizers}",
|
||||
style: TextStyle(fontSize: 15.0))
|
||||
]),
|
||||
Row(children: [
|
||||
Icon(Icons.description),
|
||||
|
Loading…
x
Reference in New Issue
Block a user