diff --git a/lib/ui/add_page/widgets/confirmation_popup.dart b/lib/ui/add_page/widgets/confirmation_popup.dart index b365959..84041d2 100644 --- a/lib/ui/add_page/widgets/confirmation_popup.dart +++ b/lib/ui/add_page/widgets/confirmation_popup.dart @@ -113,42 +113,45 @@ class _ConfirmationPopupState extends State { ), TextButton( onPressed: () async { - if (widget.viewModel.askPrice && - _formKey.currentState!.validate()) { - _formKey.currentState!.save(); - } - var result = await widget.viewModel.sendBook( widget.book, widget.viewModel.currentOwner!, widget.viewModel.currentBal!, price, ); - switch (result) { case Ok(): - if (context.mounted) { - Navigator.of(context).pop(); + switch (widget.viewModel.askPrice) { + 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; case Error(): if (context.mounted) { diff --git a/lib/ui/bal_page/widget/pending/bal_pending_screen.dart b/lib/ui/bal_page/widget/pending/bal_pending_screen.dart index a6f0769..c7af227 100644 --- a/lib/ui/bal_page/widget/pending/bal_pending_screen.dart +++ b/lib/ui/bal_page/widget/pending/bal_pending_screen.dart @@ -139,14 +139,13 @@ class _EditPopup extends State { ), Row( children: [ - Text("Date : "), + Text("Date de début : "), TextButton( onPressed: () { _selectRange(); }, child: Text( "Du ${format.format(start ?? DateTime.now())}\nau ${format.format(end ?? DateTime.now().add(Duration(days: 1)))}", - textAlign: TextAlign.center, ), ), ], diff --git a/lib/ui/home_page/widgets/create_confirmation_popup.dart b/lib/ui/home_page/widgets/create_confirmation_popup.dart index d9205c4..bfa9fc2 100644 --- a/lib/ui/home_page/widgets/create_confirmation_popup.dart +++ b/lib/ui/home_page/widgets/create_confirmation_popup.dart @@ -66,14 +66,13 @@ class _CreateConfirmationPopupState extends State { ), Row( children: [ - Text("Date : "), + Text("Date de début : "), TextButton( onPressed: () { _selectRange(); }, child: Text( "Du ${format.format(start ?? DateTime.now())}\nau ${format.format(end ?? DateTime.now().add(Duration(days: 1)))}", - textAlign: TextAlign.center, ), ), ],