Note Editing: Show a different message

Also allow us to go back if the note has not been modified. I say note
but I really mean 'journal'. These two words are used interchangably.
This commit is contained in:
Vishesh Handa
2019-01-18 15:45:02 +01:00
parent 652ed6ffe5
commit 99392955c9

View File

@ -46,6 +46,12 @@ class NoteEditorState extends State<NoteEditor> {
if (noteContent.isEmpty) {
return true;
}
if (note != null) {
if (noteContent == note.body) {
return true;
}
}
return showDialog(
context: context,
builder: _buildAlertDialog,
@ -97,10 +103,14 @@ 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?";
return new AlertDialog(
// FIXME: Change this to 'Save' vs 'Discard'
title: new Text('Are you sure?'),
content: new Text('Do you want to discard the entry'),
content: new Text(title),
actions: <Widget>[
new FlatButton(
onPressed: () => Navigator.of(context).pop(false),