Compare commits

..

No commits in common. "5923e8dcc5c216dd152730417dca400cdb60a0cf" and "e5a8745e0ef4f5abf5d26581942b068d68992e56" have entirely different histories.

3 changed files with 32 additions and 31 deletions

View file

@ -113,42 +113,45 @@ class _ConfirmationPopupState extends State<ConfirmationPopup> {
), ),
TextButton( TextButton(
onPressed: () async { onPressed: () async {
if (widget.viewModel.askPrice &&
_formKey.currentState!.validate()) {
_formKey.currentState!.save();
}
var result = await widget.viewModel.sendBook( var result = await widget.viewModel.sendBook(
widget.book, widget.book,
widget.viewModel.currentOwner!, widget.viewModel.currentOwner!,
widget.viewModel.currentBal!, widget.viewModel.currentBal!,
price, price,
); );
switch (result) { switch (result) {
case Ok(): case Ok():
if (context.mounted) { switch (widget.viewModel.askPrice) {
Navigator.of(context).pop(); case true:
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
"\"${widget.book.title}\" ($price€) a bien été enregistré",
),
behavior: SnackBarBehavior.floating,
),
);
widget.exitPopup(context);
}
}
break;
case false:
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
"\"${widget.book.title}\" (PL) a bien été enregistré",
),
behavior: SnackBarBehavior.floating,
),
);
widget.exitPopup(context);
}
} }
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
"ID : ${widget.viewModel.currentOwner!.firstName[0]}${widget.viewModel.currentOwner!.lastName[0]}${(price == 0) ? "PL" : price.toString()}",
),
content: Text(
"Identifiant propriétaire de ce livre. Pensez à l'écrire pour retrouver lae propriétaire du livre lors de la vente ou du retour !",
),
actions: [
TextButton(
onPressed: () {
widget.exitPopup(context);
},
child: Text("Ok"),
),
],
),
);
break; break;
case Error(): case Error():
if (context.mounted) { if (context.mounted) {

View file

@ -139,14 +139,13 @@ class _EditPopup extends State<EditPopup> {
), ),
Row( Row(
children: [ children: [
Text("Date : "), Text("Date de début : "),
TextButton( TextButton(
onPressed: () { onPressed: () {
_selectRange(); _selectRange();
}, },
child: Text( child: Text(
"Du ${format.format(start ?? DateTime.now())}\nau ${format.format(end ?? DateTime.now().add(Duration(days: 1)))}", "Du ${format.format(start ?? DateTime.now())}\nau ${format.format(end ?? DateTime.now().add(Duration(days: 1)))}",
textAlign: TextAlign.center,
), ),
), ),
], ],

View file

@ -66,14 +66,13 @@ class _CreateConfirmationPopupState extends State<CreateConfirmationPopup> {
), ),
Row( Row(
children: [ children: [
Text("Date : "), Text("Date de début : "),
TextButton( TextButton(
onPressed: () { onPressed: () {
_selectRange(); _selectRange();
}, },
child: Text( child: Text(
"Du ${format.format(start ?? DateTime.now())}\nau ${format.format(end ?? DateTime.now().add(Duration(days: 1)))}", "Du ${format.format(start ?? DateTime.now())}\nau ${format.format(end ?? DateTime.now().add(Duration(days: 1)))}",
textAlign: TextAlign.center,
), ),
), ),
], ],