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:
lib
@ -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)
|
||||
|
Reference in New Issue
Block a user