mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
Journal/Markdown Editor: Change tick-mark back to cross when empty
When creating a new note, if some text is written and then removed, we should update the icon accordingly. Ideally it would be awesome if this could be done for any changes, but I think comparing the body of the note after each change might be too expensive.
This commit is contained in:
@ -109,11 +109,15 @@ class JournalEditorState extends State<JournalEditor> implements EditorState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _noteTextChanged() {
|
void _noteTextChanged() {
|
||||||
if (_noteModified) return;
|
if (_noteModified && !widget.isNewNote) return;
|
||||||
|
|
||||||
|
var newState = !(widget.isNewNote && _textController.text.trim().isEmpty);
|
||||||
|
if (newState != _noteModified) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_noteModified = true;
|
_noteModified = newState;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> addImage(File file) async {
|
Future<void> addImage(File file) async {
|
||||||
|
@ -149,11 +149,15 @@ class MarkdownEditorState extends State<MarkdownEditor> implements EditorState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _noteTextChanged() {
|
void _noteTextChanged() {
|
||||||
if (_noteModified) return;
|
if (_noteModified && !widget.isNewNote) return;
|
||||||
|
|
||||||
|
var newState = !(widget.isNewNote && _textController.text.trim().isEmpty);
|
||||||
|
if (newState != _noteModified) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_noteModified = true;
|
_noteModified = newState;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> addImage(File file) async {
|
Future<void> addImage(File file) async {
|
||||||
|
Reference in New Issue
Block a user