Fix error dialog
Because the button is not inside the Scaffold we can use a snackbar
This commit is contained in:
+16
-2
@@ -112,6 +112,8 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
|
|||||||
"Alcohol": FontAwesomeIcons.beer,
|
"Alcohol": FontAwesomeIcons.beer,
|
||||||
"Fast food": FontAwesomeIcons.hamburger,
|
"Fast food": FontAwesomeIcons.hamburger,
|
||||||
"Bills": FontAwesomeIcons.wallet,
|
"Bills": FontAwesomeIcons.wallet,
|
||||||
|
"Transport": FontAwesomeIcons.carAlt,
|
||||||
|
"Other": FontAwesomeIcons.infinity,
|
||||||
},
|
},
|
||||||
onValueChanged: (newCategory) => category = newCategory,
|
onValueChanged: (newCategory) => category = newCategory,
|
||||||
),
|
),
|
||||||
@@ -286,8 +288,20 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
|
|||||||
|
|
||||||
_controller.reverse();
|
_controller.reverse();
|
||||||
} else {
|
} else {
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
showDialog(
|
||||||
content: Text("Select a value and a cagtegory")));
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
content: Text("You need to select a category and a value greater than zero."),
|
||||||
|
actions: <Widget>[
|
||||||
|
FlatButton(
|
||||||
|
child: Text('Ok'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user