mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-31 08:33:23 +08:00
JournalListing: Use 'modified' date if 'created' is missing / invalid
This commit is contained in:
@ -78,22 +78,28 @@ 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 formatter = DateFormat('dd MMM, yyyy ');
|
var date = note.created;
|
||||||
var date = formatter.format(note.created);
|
if (date != null && date.year < 10) date = note.modified;
|
||||||
|
if (date != null && date.year > 10) {
|
||||||
|
var formatter = DateFormat('dd MMM, yyyy ');
|
||||||
|
var dateStr = formatter.format(date);
|
||||||
|
|
||||||
var timeFormatter = DateFormat('Hm');
|
var timeFormatter = DateFormat('Hm');
|
||||||
var time = timeFormatter.format(note.created);
|
var time = timeFormatter.format(date);
|
||||||
|
|
||||||
var timeColor = textTheme.body1.color.withAlpha(100);
|
var timeColor = textTheme.body1.color.withAlpha(100);
|
||||||
|
|
||||||
titleWidget = Row(
|
titleWidget = Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(date, style: textTheme.title),
|
Text(dateStr, style: textTheme.title),
|
||||||
Text(time, style: textTheme.body1.copyWith(color: timeColor)),
|
Text(time, style: textTheme.body1.copyWith(color: timeColor)),
|
||||||
],
|
],
|
||||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||||
textBaseline: TextBaseline.alphabetic,
|
textBaseline: TextBaseline.alphabetic,
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
titleWidget = Text(note.fileName, style: textTheme.title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var body = stripMarkdownFormatting(note.body);
|
var body = stripMarkdownFormatting(note.body);
|
||||||
|
Reference in New Issue
Block a user