add more info

This commit is contained in:
Valentin CZERYBA 2024-07-06 09:43:35 +02:00
parent 34c2b5d322
commit 7d04953fa7

View File

@ -66,6 +66,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
String eventName = "";
String eventStartDate = "";
String organizers = "";
String place = "";
Events? events;
@override
@ -81,6 +82,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
String formerName = "";
String formerDate = "";
String formerOrga = "";
String formerMap = "";
if (accessToken.isNotEmpty) {
var urlGet = Uri.parse("${globals.api}/events/${widget.title}");
@ -92,6 +94,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
stderr.writeln('Username : ${responseGet.body}');
var events = jsonDecode(utf8.decode(responseGet.bodyBytes));
formerName = events["name"];
formerMap = events["place"];
final startDate = DateTime.parse(events["start_date"]);
final date = DateFormat.yMd().format(startDate);
final time = DateFormat.Hm().format(startDate);
@ -101,8 +104,9 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
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}";
formerOrga = "${events['organizers'][0]}";
for (var i = 1; i < events["organizers"].length; i++) {
formerOrga = "${formerOrga}, ${events['organizers'][i]}";
}
} else {
formerOrga = "${events['organizers'][0]}";
@ -161,6 +165,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
eventName = formerName;
eventStartDate = formerDate;
organizers = formerOrga;
place = formerMap;
});
}
@ -199,6 +204,10 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
style: TextStyle(fontSize: 15.0))
],
),
Row(children: [
Icon(Icons.explore),
Text("Carte : ${place}", style: TextStyle(fontSize: 15.0))
]),
Row(children: [
Icon(Icons.group),
Text("Organisateurs : ${organizers}",