mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-01 04:07:53 +08:00
JournalList: Make it slightly prettier
I'm not using the Theme everywhere, and I should ideally be changing it instead of using custom fonts, but lets just go with this for now.
This commit is contained in:
@ -10,8 +10,6 @@ class JournalList extends StatelessWidget {
|
|||||||
final NoteSelectedFunction noteSelectedFunction;
|
final NoteSelectedFunction noteSelectedFunction;
|
||||||
final List<Note> notes;
|
final List<Note> notes;
|
||||||
|
|
||||||
final _biggerFont = const TextStyle(fontSize: 18.0);
|
|
||||||
|
|
||||||
JournalList({
|
JournalList({
|
||||||
@required this.notes,
|
@required this.notes,
|
||||||
@required this.noteSelectedFunction,
|
@required this.noteSelectedFunction,
|
||||||
@ -48,7 +46,7 @@ class JournalList extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRow(BuildContext context, Note journal, int noteIndex) {
|
Widget _buildRow(BuildContext context, Note journal, int noteIndex) {
|
||||||
var formatter = DateFormat('dd MMM, yyyy');
|
var formatter = DateFormat('dd MMM, yyyy - EE');
|
||||||
var title = formatter.format(journal.created);
|
var title = formatter.format(journal.created);
|
||||||
|
|
||||||
var timeFormatter = DateFormat('Hm');
|
var timeFormatter = DateFormat('Hm');
|
||||||
@ -57,18 +55,35 @@ class JournalList extends StatelessWidget {
|
|||||||
var body = journal.body;
|
var body = journal.body;
|
||||||
body = body.replaceAll("\n", " ");
|
body = body.replaceAll("\n", " ");
|
||||||
|
|
||||||
return ListTile(
|
var textTheme = Theme.of(context).textTheme;
|
||||||
|
|
||||||
|
var tile = ListTile(
|
||||||
|
key: ValueKey(journal.filePath),
|
||||||
isThreeLine: true,
|
isThreeLine: true,
|
||||||
title: Text(
|
title: Text(
|
||||||
title,
|
title,
|
||||||
style: _biggerFont,
|
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Column(
|
||||||
time + "\n" + body,
|
children: <Widget>[
|
||||||
maxLines: 3,
|
SizedBox(height: 4.0),
|
||||||
overflow: TextOverflow.ellipsis,
|
Text(time, style: textTheme.body1),
|
||||||
|
SizedBox(height: 4.0),
|
||||||
|
Text(
|
||||||
|
body,
|
||||||
|
maxLines: 3,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: textTheme.body1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
),
|
),
|
||||||
onTap: () => noteSelectedFunction(noteIndex),
|
onTap: () => noteSelectedFunction(noteIndex),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
|
||||||
|
child: tile,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user