add info for event

This commit is contained in:
Valentin CZERYBA 2024-09-25 23:08:28 +02:00
parent 5e0d3ab72e
commit 1cdae0bb33
3 changed files with 18 additions and 4 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;
}); });
} }
@ -230,7 +235,8 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
]), ]),
Row(children: [ Row(children: [
Icon(Icons.description), Icon(Icons.description),
Text("Description : ", style: TextStyle(fontSize: 15.0)) Text("Description : ${eventDescription}",
style: TextStyle(fontSize: 15.0))
]) ])
], ],
))); )));