mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
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:
@ -46,6 +46,12 @@ class NoteEditorState extends State<NoteEditor> {
|
|||||||
if (noteContent.isEmpty) {
|
if (noteContent.isEmpty) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (note != null) {
|
||||||
|
if (noteContent == note.body) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: _buildAlertDialog,
|
builder: _buildAlertDialog,
|
||||||
@ -97,10 +103,14 @@ class NoteEditorState extends State<NoteEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildAlertDialog(BuildContext context) {
|
Widget _buildAlertDialog(BuildContext context) {
|
||||||
|
var title = newNote
|
||||||
|
? "Do you want to discard the entry"
|
||||||
|
: "Do you want to discard the changes?";
|
||||||
|
|
||||||
return new AlertDialog(
|
return new AlertDialog(
|
||||||
// FIXME: Change this to 'Save' vs 'Discard'
|
// FIXME: Change this to 'Save' vs 'Discard'
|
||||||
title: new Text('Are you sure?'),
|
title: new Text('Are you sure?'),
|
||||||
content: new Text('Do you want to discard the entry'),
|
content: new Text(title),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
new FlatButton(
|
new FlatButton(
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
|
Reference in New Issue
Block a user