From eb0d9cd524157470216deea9f559194b6c71eb5a Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Tue, 2 Jul 2019 10:15:04 -0300 Subject: [PATCH] Fix error dialog Because the button is not inside the Scaffold we can use a snackbar --- lib/pages/add_page.dart | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/pages/add_page.dart b/lib/pages/add_page.dart index 31d40f1..2fc5b4f 100644 --- a/lib/pages/add_page.dart +++ b/lib/pages/add_page.dart @@ -112,6 +112,8 @@ class _AddPageState extends State with SingleTickerProviderStateMixin { "Alcohol": FontAwesomeIcons.beer, "Fast food": FontAwesomeIcons.hamburger, "Bills": FontAwesomeIcons.wallet, + "Transport": FontAwesomeIcons.carAlt, + "Other": FontAwesomeIcons.infinity, }, onValueChanged: (newCategory) => category = newCategory, ), @@ -286,8 +288,20 @@ class _AddPageState extends State with SingleTickerProviderStateMixin { _controller.reverse(); } else { - Scaffold.of(context).showSnackBar(SnackBar( - content: Text("Select a value and a cagtegory"))); + showDialog( + context: context, + builder: (context) => AlertDialog( + content: Text("You need to select a category and a value greater than zero."), + actions: [ + FlatButton( + child: Text('Ok'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ) + ); } }, ),