tags and organizers work

This commit is contained in:
Valentin CZERYBA 2024-12-11 22:20:32 +01:00
parent b8e6adf2e8
commit 0dc098554c
2 changed files with 17 additions and 12 deletions

View File

@ -21,18 +21,27 @@ void main() {
class MyApp extends StatelessWidget {
Map<String, dynamic> events = {};
String id = "";
List<String> organizers = [];
List<String> tags = [];
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: EditEvent(id: id),
home: EditEvent(id: id, organizers: organizers, tags: tags),
);
}
}
class EditEvent extends StatefulWidget {
const EditEvent({Key? key, required this.id}) : super(key: key);
const EditEvent(
{Key? key,
required this.id,
required this.tags,
required this.organizers})
: super(key: key);
final String id;
final List<String> tags;
final List<String> organizers;
@override
_EditEventState createState() => _EditEventState();
@ -152,8 +161,6 @@ class _EditEventState extends State<EditEvent>
String formerMap = "";
String formerImage = "";
String formerDesc = "";
List<String> formerTags = [];
List<String> formerOrga = [];
if (accessToken.isNotEmpty) {
var urlGet = Uri.parse("${globals.api}/events/${widget.id}");
@ -235,12 +242,6 @@ class _EditEventState extends State<EditEvent>
inputGeo.text = formerMap;
imgUrl = formerImage;
inputDesc.text = formerDesc;
for (int i = 0; i < events["tags"].length; i++) {
_stringTagController.addTag(events["tags"][i]);
}
for (int i = 0; i < events["organizers"].length; i++) {
_stringOrgaController.addTag(events["organizers"][i]);
}
});
}
@ -430,8 +431,10 @@ class _EditEventState extends State<EditEvent>
@override
void initState() {
_getEventInfos();
initialTags = List<String>.from(widget.tags as List);
initialOrga = List<String>.from(widget.organizers as List);
super.initState();
_getEventInfos();
}
final _formKey = GlobalKey<FormState>();

View File

@ -404,7 +404,9 @@ class _ItemMenuState extends State<ItemMenu> with ShowErrorDialog {
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => EditEvent(id: id)),
MaterialPageRoute(
builder: (_) =>
EditEvent(id: id, tags: tags, organizers: organizers)),
);
},
backgroundColor: Colors.blue,