1
0
mirror of https://github.com/GitJournal/GitJournal.git synced 2025-07-09 19:54:17 +08:00

Simplify the code

Now the Note's modified/created can never have a date with a year = 10
meaning a special thing.
This commit is contained in:
Vishesh Handa
2020-01-07 23:56:58 +01:00
parent 4be91f92f0
commit b6b49e84e4
2 changed files with 3 additions and 3 deletions

@ -154,6 +154,7 @@ class StateContainerState extends State<StateContainer> {
} }
void removeNote(Note note) { void removeNote(Note note) {
// FIXME: What if the Note hasn't yet been saved?
note.parent.remove(note); note.parent.remove(note);
_gitRepo.removeNote(note.filePath).then((NoteRepoResult _) async { _gitRepo.removeNote(note.filePath).then((NoteRepoResult _) async {
// FIXME: Is there a way of figuring this amount dynamically? // FIXME: Is there a way of figuring this amount dynamically?

@ -77,9 +77,8 @@ class JournalList extends StatelessWidget {
var title = note.title; var title = note.title;
Widget titleWidget = Text(title, style: textTheme.title); Widget titleWidget = Text(title, style: textTheme.title);
if (title.isEmpty) { if (title.isEmpty) {
var date = note.created; var date = note.modified ?? note.created;
if (date != null && date.year < 10) date = note.modified; if (date != null) {
if (date != null && date.year > 10) {
var formatter = DateFormat('dd MMM, yyyy '); var formatter = DateFormat('dd MMM, yyyy ');
var dateStr = formatter.format(date); var dateStr = formatter.format(date);