Skip to content

Commit b6b49e8

Browse files
committed
Simplify the code
Now the Note's modified/created can never have a date with a year = 10 meaning a special thing.
1 parent 4be91f9 commit b6b49e8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/state_container.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ class StateContainerState extends State<StateContainer> {
154154
}
155155

156156
void removeNote(Note note) {
157+
// FIXME: What if the Note hasn't yet been saved?
157158
note.parent.remove(note);
158159
_gitRepo.removeNote(note.filePath).then((NoteRepoResult _) async {
159160
// FIXME: Is there a way of figuring this amount dynamically?

lib/widgets/journal_list.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ class JournalList extends StatelessWidget {
7777
var title = note.title;
7878
Widget titleWidget = Text(title, style: textTheme.title);
7979
if (title.isEmpty) {
80-
var date = note.created;
81-
if (date != null && date.year < 10) date = note.modified;
82-
if (date != null && date.year > 10) {
80+
var date = note.modified ?? note.created;
81+
if (date != null) {
8382
var formatter = DateFormat('dd MMM, yyyy ');
8483
var dateStr = formatter.format(date);
8584

0 commit comments

Comments
 (0)