mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-26 00:29:20 +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:
@ -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?
|
||||
|
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user