1
0
mirror of https://github.com/GitJournal/GitJournal.git synced 2025-07-09 11:46:20 +08:00

Note: Add a setter for body

Hides the 'NoteData' internals.
This commit is contained in:
Vishesh Handa
2019-09-27 00:39:00 +02:00
parent 475251df61
commit 78b4a25c30
2 changed files with 5 additions and 1 deletions

@ -26,6 +26,10 @@ class Note implements Comparable<Note> {
return data.body;
}
set body(String newBody) {
data.body = newBody;
}
bool hasValidDate() {
// Arbitrary number, when we set the year = 0, it becomes 1, somehow
return created.year > 10;

@ -57,7 +57,7 @@ class NoteEditorState extends State<NoteEditor> {
icon: Icon(Icons.check),
onPressed: () {
final stateContainer = StateContainer.of(context);
note.data.body = _textController.text;
note.body = _textController.text;
if (note.body.isNotEmpty) {
newNote
? stateContainer.addNote(note)