From 519d20fd63369c39671a3ef1718cf6b06ecb89fb Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 20 Oct 2024 18:23:34 +0200 Subject: [PATCH] add organizateurs --- covas_mobile/lib/pages/ItemMenu.dart | 59 ++++++++++++++++++---------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/covas_mobile/lib/pages/ItemMenu.dart b/covas_mobile/lib/pages/ItemMenu.dart index 3406264..788d204 100644 --- a/covas_mobile/lib/pages/ItemMenu.dart +++ b/covas_mobile/lib/pages/ItemMenu.dart @@ -68,10 +68,10 @@ class _ItemMenuState extends State with ShowErrorDialog { String eventName = ""; String eventStartDate = ""; String eventDescription = ""; - String organizers = ""; String place = ""; String imgUrl = ""; List tags = []; + List organizers = []; Events? events; @override @@ -86,11 +86,11 @@ class _ItemMenuState extends State with ShowErrorDialog { var accessToken = prefs.getString("access_token") ?? ""; String formerName = ""; String formerDate = ""; - String formerOrga = ""; String formerMap = ""; String formerImage = ""; String formerDesc = ""; List formerTags = []; + List formerOrga = []; if (accessToken.isNotEmpty) { var urlGet = Uri.parse("${globals.api}/events/${widget.title}"); @@ -106,6 +106,7 @@ class _ItemMenuState extends State with ShowErrorDialog { "${events["place"]} - ${events["zip_code"]} ${events["city"]} - ${events["country"]}"; formerDesc = events["description"]; formerTags = List.from(events['tags'] as List); + formerOrga = List.from(events['organizers'] as List); final startDate = DateTime.parse(events["start_date"]); final date = DateFormat.yMd().format(startDate); final time = DateFormat.Hm().format(startDate); @@ -119,14 +120,6 @@ class _ItemMenuState extends State with ShowErrorDialog { } formerDate = "${date} ${time} à ${dateE} ${timeE}"; - if (events["organizers"].length > 0) { - formerOrga = "${events['organizers'][0]}"; - for (var i = 1; i < events["organizers"].length; i++) { - formerOrga = "${formerOrga}, ${events['organizers'][i]}"; - } - } else { - formerOrga = ""; - } } else { var text = ""; switch (responseGet.statusCode) { @@ -257,13 +250,42 @@ class _ItemMenuState extends State with ShowErrorDialog { ) ]), Row(children: [ - Flexible( - child: Text( - "${organizers}", - style: TextStyle(fontSize: 15.0), - maxLines: 3, - overflow: TextOverflow.ellipsis, - )) + Padding( + padding: const EdgeInsets.only( + top: 8, + bottom: 8, + left: 8, + ), + child: Wrap( + runSpacing: 4.0, + spacing: 4.0, + direction: Axis.vertical, + children: organizers.map((String tag) { + return Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(20.0), + ), + color: Colors.blue, + ), + margin: const EdgeInsets.symmetric(horizontal: 5.0), + padding: const EdgeInsets.symmetric( + horizontal: 10.0, vertical: 5.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + InkWell( + child: Text( + '$tag', + style: const TextStyle(color: Colors.white), + ), + ), + ], + ), + ); + }).toList()), + ), ]), Row(children: [ Icon(Icons.description), @@ -314,9 +336,6 @@ class _ItemMenuState extends State with ShowErrorDialog { '$tag', style: const TextStyle(color: Colors.white), ), - onTap: () { - //print("$tag selected"); - }, ), ], ),