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) {
var title = newNote
? "Do you want to discard the entry"
: "Do you want to discard the changes?";
? "Do you want to discard this?"
: "Do you want to ignore the changes?";
var editText = newNote ? "Keep Writing" : "Keep Editing";
var discardText = newNote ? "Discard" : "Discard Changes";
return AlertDialog(
// FIXME: Change this to 'Save' vs 'Discard'
title: Text('Are you sure?'),
content: Text(title),
title: Text(title),
actions: <Widget>[
FlatButton(
onPressed: () => Navigator.of(context).pop(false),
child: Text('No'),
child: Text(editText),
),
FlatButton(
onPressed: () {
Navigator.pop(context); // Alert box
Navigator.pop(context); // Note Editor
},
child: Text('Yes'),
child: Text(discardText),
),
],
);