Implement a basic Zen Mode

This can be enabled in all the editors.
This commit is contained in:
Vishesh Handa
2020-07-27 09:39:31 +02:00
parent 6d101ad5c4
commit e9cc050866
6 changed files with 111 additions and 19 deletions

View File

@ -48,7 +48,9 @@ class JournalEditor extends StatefulWidget implements Editor {
}
}
class JournalEditorState extends State<JournalEditor> implements EditorState {
class JournalEditorState extends State<JournalEditor>
with ChangeNotifier
implements EditorState {
Note note;
TextEditingController _textController = TextEditingController();
bool _noteModified;
@ -110,7 +112,10 @@ class JournalEditorState extends State<JournalEditor> implements EditorState {
}
void _noteTextChanged() {
if (_noteModified && !widget.isNewNote) return;
if (_noteModified && !widget.isNewNote) {
notifyListeners();
return;
}
var newState = !(widget.isNewNote && _textController.text.trim().isEmpty);
if (newState != _noteModified) {
@ -118,6 +123,8 @@ class JournalEditorState extends State<JournalEditor> implements EditorState {
_noteModified = newState;
});
}
notifyListeners();
}
@override