diff --git a/lib/note.dart b/lib/note.dart index 34897052..b988b3be 100644 --- a/lib/note.dart +++ b/lib/note.dart @@ -4,10 +4,10 @@ typedef NoteUpdator(Note note); class Note implements Comparable { String id; - DateTime createdAt; + DateTime created; String body; - Note({this.createdAt, this.body, this.id}); + Note({this.created, this.body, this.id}); factory Note.fromJson(Map json) { String id; @@ -22,21 +22,21 @@ class Note implements Comparable { return new Note( id: id, - createdAt: DateTime.parse(json['createdAt']), + created: DateTime.parse(json['created']), body: json['body'], ); } Map toJson() { return { - "createdAt": createdAt.toIso8601String(), + "created": created.toIso8601String(), "body": body, "id": id, }; } @override - int get hashCode => id.hashCode ^ createdAt.hashCode ^ body.hashCode; + int get hashCode => id.hashCode ^ created.hashCode ^ body.hashCode; @override bool operator ==(Object other) => @@ -45,15 +45,15 @@ class Note implements Comparable { runtimeType == other.runtimeType && id == other.id && body == other.body && - createdAt == other.createdAt; + created == other.created; @override String toString() { - return 'Note{id: $id, body: $body, createdAt: $createdAt}'; + return 'Note{id: $id, body: $body, createdAt: $created}'; } @override - int compareTo(other) => createdAt.compareTo(other.createdAt); + int compareTo(other) => created.compareTo(other.created); } class AppState { diff --git a/lib/note_editor.dart b/lib/note_editor.dart index 058e93cb..04eed13b 100644 --- a/lib/note_editor.dart +++ b/lib/note_editor.dart @@ -80,7 +80,7 @@ class NoteEditorState extends State { onPressed: () { var noteContent = noteTextKey.currentState.value; var note = new Note( - createdAt: _createdAt, + created: _createdAt, body: noteContent, ); container.addNote(note); diff --git a/lib/note_viewer.dart b/lib/note_viewer.dart index 9013184b..00cc2acf 100644 --- a/lib/note_viewer.dart +++ b/lib/note_viewer.dart @@ -85,11 +85,11 @@ class NoteViewer extends StatelessWidget { } Widget _buildHeader(BuildContext context) { - var dateStr = DateFormat('MMM dd, yyyy').format(note.createdAt); - var timeStr = DateFormat('EEEE H:m').format(note.createdAt); + var dateStr = DateFormat('MMM dd, yyyy').format(note.created); + var timeStr = DateFormat('EEEE H:m').format(note.created); var bigNum = new Text( - note.createdAt.day.toString(), + note.created.day.toString(), style: TextStyle(fontSize: 40.0), ); diff --git a/lib/widgets/journal_list.dart b/lib/widgets/journal_list.dart index 2631bd56..5cb85bb1 100644 --- a/lib/widgets/journal_list.dart +++ b/lib/widgets/journal_list.dart @@ -53,10 +53,10 @@ class JournalList extends StatelessWidget { Widget _buildRow(BuildContext context, Note journal, int noteIndex) { var formatter = new DateFormat('dd MMM, yyyy'); - var title = formatter.format(journal.createdAt); + var title = formatter.format(journal.created); var timeFormatter = new DateFormat('Hm'); - var time = timeFormatter.format(journal.createdAt); + var time = timeFormatter.format(journal.created); var body = journal.body; body = body.replaceAll("\n", " "); diff --git a/test/serializers_test.dart b/test/serializers_test.dart index d666ba58..5e691a35 100644 --- a/test/serializers_test.dart +++ b/test/serializers_test.dart @@ -8,7 +8,7 @@ import 'package:test/test.dart'; main() { group('Serializers', () { var note = - Note(id: "2", body: "This is the body", createdAt: new DateTime.now()); + Note(id: "2", body: "This is the body", created: new DateTime.now()); test('JSON Serializer', () { var jsonSerializer = new JsonNoteSerializer();