display message to add events
This commit is contained in:
parent
4af1d12283
commit
dc605b1a7c
@ -1,14 +1,25 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'events.dart';
|
||||||
|
|
||||||
mixin ShowDescImageAdd<T extends StatefulWidget> on State<T> {
|
mixin ShowDescImageAdd<T extends StatefulWidget> on State<T> {
|
||||||
void showDescImageAddDialog(BuildContext context, String text) {
|
void showDescImageAddDialog(BuildContext context, var events) {
|
||||||
// Create AlertDialog
|
// Create AlertDialog
|
||||||
|
String name = events['name'];
|
||||||
AlertDialog dialog = AlertDialog(
|
AlertDialog dialog = AlertDialog(
|
||||||
title: Text("Description image"),
|
title: Text("Ajouter un evenement"),
|
||||||
content: Text(text),
|
content: Text("${name} n'a pas été trouvé. Voulez-vous l'ajouter ? "),
|
||||||
actions: [
|
actions: [
|
||||||
ElevatedButton(
|
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(
|
style: ElevatedButton.styleFrom(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20),
|
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20),
|
||||||
textStyle:
|
textStyle:
|
||||||
|
@ -85,7 +85,7 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen>
|
|||||||
var events = jsonDecode(utf8.decode(responseGet.bodyBytes));
|
var events = jsonDecode(utf8.decode(responseGet.bodyBytes));
|
||||||
print("reponse http : ${events.length}");
|
print("reponse http : ${events.length}");
|
||||||
if (events.length == 0) {
|
if (events.length == 0) {
|
||||||
showDescImageAddDialog(context, "${name} n'a pas été trouvé");
|
showDescImageAddDialog(context, jsonData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user