mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-15 07:56:11 +08:00
Note: Add a setter for body
Hides the 'NoteData' internals.
This commit is contained in:
@ -26,6 +26,10 @@ class Note implements Comparable<Note> {
|
|||||||
return data.body;
|
return data.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set body(String newBody) {
|
||||||
|
data.body = newBody;
|
||||||
|
}
|
||||||
|
|
||||||
bool hasValidDate() {
|
bool hasValidDate() {
|
||||||
// Arbitrary number, when we set the year = 0, it becomes 1, somehow
|
// Arbitrary number, when we set the year = 0, it becomes 1, somehow
|
||||||
return created.year > 10;
|
return created.year > 10;
|
||||||
|
@ -57,7 +57,7 @@ class NoteEditorState extends State<NoteEditor> {
|
|||||||
icon: Icon(Icons.check),
|
icon: Icon(Icons.check),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final stateContainer = StateContainer.of(context);
|
final stateContainer = StateContainer.of(context);
|
||||||
note.data.body = _textController.text;
|
note.body = _textController.text;
|
||||||
if (note.body.isNotEmpty) {
|
if (note.body.isNotEmpty) {
|
||||||
newNote
|
newNote
|
||||||
? stateContainer.addNote(note)
|
? stateContainer.addNote(note)
|
||||||
|
Reference in New Issue
Block a user