From 1cdae0bb339326ff21a5720fc3374c247c5bac45 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 25 Sep 2024 23:08:28 +0200 Subject: [PATCH 1/4] add info for event --- covas_mobile/lib/classes/alert.dart | 2 -- covas_mobile/lib/classes/events.dart | 10 ++++++++++ covas_mobile/lib/pages/ItemMenu.dart | 10 ++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/covas_mobile/lib/classes/alert.dart b/covas_mobile/lib/classes/alert.dart index ea691aa..7ca853a 100644 --- a/covas_mobile/lib/classes/alert.dart +++ b/covas_mobile/lib/classes/alert.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -import '../main.dart'; - mixin ShowErrorDialog on State { void showErrorDialog(BuildContext context, String text) { // Create AlertDialog diff --git a/covas_mobile/lib/classes/events.dart b/covas_mobile/lib/classes/events.dart index c1cb070..d908a58 100644 --- a/covas_mobile/lib/classes/events.dart +++ b/covas_mobile/lib/classes/events.dart @@ -3,6 +3,11 @@ class Events { String? name; String? place; String? startDate; + String? endDate; + String? description; + String? zipCode; + String? city; + String? country; Events({this.place, this.id, this.name, this.startDate}); @@ -11,5 +16,10 @@ class Events { name = json['name']; place = json['place']; startDate = json["start_date"]; + endDate = json['end_date']; + description = json['description']; + zipCode = json["zip_code"]; + city = json['city']; + country = json['country']; } } diff --git a/covas_mobile/lib/pages/ItemMenu.dart b/covas_mobile/lib/pages/ItemMenu.dart index 77710e2..1d6e920 100644 --- a/covas_mobile/lib/pages/ItemMenu.dart +++ b/covas_mobile/lib/pages/ItemMenu.dart @@ -67,6 +67,7 @@ class _ItemMenuState extends State with ShowErrorDialog { String listUser = ""; String eventName = ""; String eventStartDate = ""; + String eventDescription = ""; String organizers = ""; String place = ""; String imgUrl = ""; @@ -87,6 +88,7 @@ class _ItemMenuState extends State with ShowErrorDialog { String formerOrga = ""; String formerMap = ""; String formerImage = ""; + String formerDesc = ""; if (accessToken.isNotEmpty) { var urlGet = Uri.parse("${globals.api}/events/${widget.title}"); @@ -98,7 +100,9 @@ class _ItemMenuState extends State with ShowErrorDialog { stderr.writeln('Username : ${responseGet.body}'); var events = jsonDecode(utf8.decode(responseGet.bodyBytes)); formerName = events["name"]; - formerMap = events["place"]; + formerMap = + "${events["place"]} - ${events["zip_code"]} ${events["city"]} - ${events["country"]}"; + formerDesc = events["description"]; final startDate = DateTime.parse(events["start_date"]); final date = DateFormat.yMd().format(startDate); final time = DateFormat.Hm().format(startDate); @@ -176,6 +180,7 @@ class _ItemMenuState extends State with ShowErrorDialog { organizers = formerOrga; place = formerMap; imgUrl = formerImage; + eventDescription = formerDesc; }); } @@ -230,7 +235,8 @@ class _ItemMenuState extends State with ShowErrorDialog { ]), Row(children: [ Icon(Icons.description), - Text("Description : ", style: TextStyle(fontSize: 15.0)) + Text("Description : ${eventDescription}", + style: TextStyle(fontSize: 15.0)) ]) ], ))); From 47dfcc3632ba205309b638a12d789ba8babc8eb3 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 29 Sep 2024 11:02:27 +0200 Subject: [PATCH 2/4] add flexible --- covas_mobile/lib/pages/ItemMenu.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/covas_mobile/lib/pages/ItemMenu.dart b/covas_mobile/lib/pages/ItemMenu.dart index 1d6e920..5854910 100644 --- a/covas_mobile/lib/pages/ItemMenu.dart +++ b/covas_mobile/lib/pages/ItemMenu.dart @@ -226,7 +226,11 @@ class _ItemMenuState extends State with ShowErrorDialog { ), Row(children: [ Icon(Icons.explore), - Text("Carte : ${place}", style: TextStyle(fontSize: 15.0)) + Flexible( + child: Text("Carte : ${place}", + style: TextStyle(fontSize: 15.0), + maxLines: 3, + overflow: TextOverflow.ellipsis)) ]), Row(children: [ Icon(Icons.group), @@ -235,8 +239,11 @@ class _ItemMenuState extends State with ShowErrorDialog { ]), Row(children: [ Icon(Icons.description), - Text("Description : ${eventDescription}", - style: TextStyle(fontSize: 15.0)) + Flexible( + child: Text("Description : ${eventDescription}", + style: TextStyle(fontSize: 15.0), + maxLines: 3, + overflow: TextOverflow.ellipsis)) ]) ], ))); From 45dc5d6c841ef42a6c9362cdcdf09b3634451f9b Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 29 Sep 2024 12:35:52 +0200 Subject: [PATCH 3/4] formating text description --- covas_mobile/lib/pages/ItemMenu.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/covas_mobile/lib/pages/ItemMenu.dart b/covas_mobile/lib/pages/ItemMenu.dart index 5854910..cda686b 100644 --- a/covas_mobile/lib/pages/ItemMenu.dart +++ b/covas_mobile/lib/pages/ItemMenu.dart @@ -239,8 +239,12 @@ class _ItemMenuState extends State with ShowErrorDialog { ]), Row(children: [ Icon(Icons.description), + Text("Description : ", + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold)) + ]), + Row(children: [ Flexible( - child: Text("Description : ${eventDescription}", + child: Text("${eventDescription}", style: TextStyle(fontSize: 15.0), maxLines: 3, overflow: TextOverflow.ellipsis)) From b283165a86b784737c2253d6ad4f8cd845b23de7 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 29 Sep 2024 12:52:02 +0200 Subject: [PATCH 4/4] formatting text --- covas_mobile/lib/pages/ItemMenu.dart | 36 +++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/covas_mobile/lib/pages/ItemMenu.dart b/covas_mobile/lib/pages/ItemMenu.dart index cda686b..b45ee48 100644 --- a/covas_mobile/lib/pages/ItemMenu.dart +++ b/covas_mobile/lib/pages/ItemMenu.dart @@ -217,25 +217,49 @@ class _ItemMenuState extends State with ShowErrorDialog { child: Container(height: 250, child: Image.network(imgUrl)), ), ), + Row(children: [ + Icon(Icons.event), + Text( + "Date : ", + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold), + ) + ]), Row( children: [ - Icon(Icons.event), - Text("Date : ${eventStartDate}", - style: TextStyle(fontSize: 15.0)) + Flexible( + child: Text("${eventStartDate}", + style: TextStyle(fontSize: 15.0))) ], ), Row(children: [ Icon(Icons.explore), + Text( + "Carte : ", + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold), + ) + ]), + Row(children: [ Flexible( - child: Text("Carte : ${place}", + child: Text("${place}", style: TextStyle(fontSize: 15.0), maxLines: 3, overflow: TextOverflow.ellipsis)) ]), Row(children: [ Icon(Icons.group), - Text("Organisateurs : ${organizers}", - style: TextStyle(fontSize: 15.0)) + Text( + "Organisateurs : ", + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold), + ) + ]), + Row(children: [ + Flexible( + child: Text( + "${organizers}", + style: TextStyle(fontSize: 15.0), + maxLines: 3, + overflow: TextOverflow.ellipsis, + )) ]), Row(children: [ Icon(Icons.description),