Merge pull request 'feature/update-desc' (#9) from feature/update-desc into main

Reviewed-on: #9
This commit is contained in:
v4l3n71n 2024-09-29 14:14:25 +02:00
commit 112eab3125
3 changed files with 59 additions and 10 deletions

View File

@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../main.dart';
mixin ShowErrorDialog<T extends StatefulWidget> on State<T> { mixin ShowErrorDialog<T extends StatefulWidget> on State<T> {
void showErrorDialog(BuildContext context, String text) { void showErrorDialog(BuildContext context, String text) {
// Create AlertDialog // Create AlertDialog

View File

@ -3,6 +3,11 @@ class Events {
String? name; String? name;
String? place; String? place;
String? startDate; String? startDate;
String? endDate;
String? description;
String? zipCode;
String? city;
String? country;
Events({this.place, this.id, this.name, this.startDate}); Events({this.place, this.id, this.name, this.startDate});
@ -11,5 +16,10 @@ class Events {
name = json['name']; name = json['name'];
place = json['place']; place = json['place'];
startDate = json["start_date"]; startDate = json["start_date"];
endDate = json['end_date'];
description = json['description'];
zipCode = json["zip_code"];
city = json['city'];
country = json['country'];
} }
} }

View File

@ -67,6 +67,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
String listUser = ""; String listUser = "";
String eventName = ""; String eventName = "";
String eventStartDate = ""; String eventStartDate = "";
String eventDescription = "";
String organizers = ""; String organizers = "";
String place = ""; String place = "";
String imgUrl = ""; String imgUrl = "";
@ -87,6 +88,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
String formerOrga = ""; String formerOrga = "";
String formerMap = ""; String formerMap = "";
String formerImage = ""; String formerImage = "";
String formerDesc = "";
if (accessToken.isNotEmpty) { if (accessToken.isNotEmpty) {
var urlGet = Uri.parse("${globals.api}/events/${widget.title}"); var urlGet = Uri.parse("${globals.api}/events/${widget.title}");
@ -98,7 +100,9 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
stderr.writeln('Username : ${responseGet.body}'); stderr.writeln('Username : ${responseGet.body}');
var events = jsonDecode(utf8.decode(responseGet.bodyBytes)); var events = jsonDecode(utf8.decode(responseGet.bodyBytes));
formerName = events["name"]; 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 startDate = DateTime.parse(events["start_date"]);
final date = DateFormat.yMd().format(startDate); final date = DateFormat.yMd().format(startDate);
final time = DateFormat.Hm().format(startDate); final time = DateFormat.Hm().format(startDate);
@ -176,6 +180,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
organizers = formerOrga; organizers = formerOrga;
place = formerMap; place = formerMap;
imgUrl = formerImage; imgUrl = formerImage;
eventDescription = formerDesc;
}); });
} }
@ -212,25 +217,61 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
child: Container(height: 250, child: Image.network(imgUrl)), child: Container(height: 250, child: Image.network(imgUrl)),
), ),
), ),
Row(children: [
Icon(Icons.event),
Text(
"Date : ",
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold),
)
]),
Row( Row(
children: [ children: [
Icon(Icons.event), Flexible(
Text("Date : ${eventStartDate}", child: Text("${eventStartDate}",
style: TextStyle(fontSize: 15.0)) style: TextStyle(fontSize: 15.0)))
], ],
), ),
Row(children: [ Row(children: [
Icon(Icons.explore), Icon(Icons.explore),
Text("Carte : ${place}", style: TextStyle(fontSize: 15.0)) Text(
"Carte : ",
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold),
)
]),
Row(children: [
Flexible(
child: Text("${place}",
style: TextStyle(fontSize: 15.0),
maxLines: 3,
overflow: TextOverflow.ellipsis))
]), ]),
Row(children: [ Row(children: [
Icon(Icons.group), Icon(Icons.group),
Text("Organisateurs : ${organizers}", Text(
style: TextStyle(fontSize: 15.0)) "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: [ Row(children: [
Icon(Icons.description), Icon(Icons.description),
Text("Description : ", style: TextStyle(fontSize: 15.0)) Text("Description : ",
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold))
]),
Row(children: [
Flexible(
child: Text("${eventDescription}",
style: TextStyle(fontSize: 15.0),
maxLines: 3,
overflow: TextOverflow.ellipsis))
]) ])
], ],
))); )));