NoteEditor: Improve cancel alert box

Better wording, and avoid a generic 'Yes' or 'No' in the buttons.
This commit is contained in:
Vishesh Handa
2019-02-16 18:32:48 +01:00
parent 3c9a773e18
commit 0762bd98c3

View File

@ -97,24 +97,25 @@ class NoteEditorState extends State<NoteEditor> {
Widget _buildAlertDialog(BuildContext context) { Widget _buildAlertDialog(BuildContext context) {
var title = newNote var title = newNote
? "Do you want to discard the entry" ? "Do you want to discard this?"
: "Do you want to discard the changes?"; : "Do you want to ignore the changes?";
var editText = newNote ? "Keep Writing" : "Keep Editing";
var discardText = newNote ? "Discard" : "Discard Changes";
return AlertDialog( return AlertDialog(
// FIXME: Change this to 'Save' vs 'Discard' title: Text(title),
title: Text('Are you sure?'),
content: Text(title),
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
onPressed: () => Navigator.of(context).pop(false), onPressed: () => Navigator.of(context).pop(false),
child: Text('No'), child: Text(editText),
), ),
FlatButton( FlatButton(
onPressed: () { onPressed: () {
Navigator.pop(context); // Alert box Navigator.pop(context); // Alert box
Navigator.pop(context); // Note Editor Navigator.pop(context); // Note Editor
}, },
child: Text('Yes'), child: Text(discardText),
), ),
], ],
); );