From dc605b1a7c6088779939a1f4204ee8846aa424ef Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 25 Jul 2024 22:23:45 +0200 Subject: [PATCH] display message to add events --- .../lib/classes/descriptionImage.dart | 19 +++++++++++++++---- .../lib/pages/DisplayPictureScreen.dart | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/covas_mobile/lib/classes/descriptionImage.dart b/covas_mobile/lib/classes/descriptionImage.dart index fdd6710..ad9543e 100644 --- a/covas_mobile/lib/classes/descriptionImage.dart +++ b/covas_mobile/lib/classes/descriptionImage.dart @@ -1,14 +1,25 @@ import 'package:flutter/material.dart'; +import 'events.dart'; mixin ShowDescImageAdd on State { - void showDescImageAddDialog(BuildContext context, String text) { + void showDescImageAddDialog(BuildContext context, var events) { // Create AlertDialog + String name = events['name']; AlertDialog dialog = AlertDialog( - title: Text("Description image"), - content: Text(text), + title: Text("Ajouter un evenement"), + content: Text("${name} n'a pas été trouvé. Voulez-vous l'ajouter ? "), actions: [ ElevatedButton( - child: Text("OK"), + child: Text("Oui"), + style: ElevatedButton.styleFrom( + padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20), + textStyle: + TextStyle(fontSize: 15, fontWeight: FontWeight.normal)), + onPressed: () { + Navigator.of(context).pop("Yes, Of course!"); // Return value + }), + ElevatedButton( + child: Text("Non"), style: ElevatedButton.styleFrom( padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20), textStyle: diff --git a/covas_mobile/lib/pages/DisplayPictureScreen.dart b/covas_mobile/lib/pages/DisplayPictureScreen.dart index b26da97..dfe6c75 100644 --- a/covas_mobile/lib/pages/DisplayPictureScreen.dart +++ b/covas_mobile/lib/pages/DisplayPictureScreen.dart @@ -85,7 +85,7 @@ class DisplayPictureScreenState extends State var events = jsonDecode(utf8.decode(responseGet.bodyBytes)); print("reponse http : ${events.length}"); if (events.length == 0) { - showDescImageAddDialog(context, "${name} n'a pas été trouvé"); + showDescImageAddDialog(context, jsonData); } } } else {