add organizateurs

This commit is contained in:
Valentin CZERYBA 2024-10-20 18:23:34 +02:00
parent fb34b41385
commit 519d20fd63

View File

@ -68,10 +68,10 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
String eventName = "";
String eventStartDate = "";
String eventDescription = "";
String organizers = "";
String place = "";
String imgUrl = "";
List<String> tags = [];
List<String> organizers = [];
Events? events;
@override
@ -86,11 +86,11 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
var accessToken = prefs.getString("access_token") ?? "";
String formerName = "";
String formerDate = "";
String formerOrga = "";
String formerMap = "";
String formerImage = "";
String formerDesc = "";
List<String> formerTags = [];
List<String> formerOrga = [];
if (accessToken.isNotEmpty) {
var urlGet = Uri.parse("${globals.api}/events/${widget.title}");
@ -106,6 +106,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
"${events["place"]} - ${events["zip_code"]} ${events["city"]} - ${events["country"]}";
formerDesc = events["description"];
formerTags = List<String>.from(events['tags'] as List);
formerOrga = List<String>.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<ItemMenu> 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<ItemMenu> 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<ItemMenu> with ShowErrorDialog {
'$tag',
style: const TextStyle(color: Colors.white),
),
onTap: () {
//print("$tag selected");
},
),
],
),