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

View File

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

View File

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