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 '../main.dart';
mixin ShowErrorDialog<T extends StatefulWidget> on State<T> {
void showErrorDialog(BuildContext context, String text) {
// Create AlertDialog

View File

@ -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'];
}
}

View File

@ -67,6 +67,7 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
String listUser = "";
String eventName = "";
String eventStartDate = "";
String eventDescription = "";
String organizers = "";
String place = "";
String imgUrl = "";
@ -87,6 +88,7 @@ class _ItemMenuState extends State<ItemMenu> 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<ItemMenu> 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<ItemMenu> with ShowErrorDialog {
organizers = formerOrga;
place = formerMap;
imgUrl = formerImage;
eventDescription = formerDesc;
});
}
@ -212,25 +217,61 @@ class _ItemMenuState extends State<ItemMenu> 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 : ${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: [
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),
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))
])
],
)));