Skip to content

Commit

Permalink
divider between lists in list mode
Browse files Browse the repository at this point in the history
  • Loading branch information
apoleon33 committed Jan 5, 2024
1 parent 32053e3 commit be86313
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 29 deletions.
11 changes: 7 additions & 4 deletions lib/albumCard/display_as_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ class DisplayAlbumAsCard extends DisplayAlbum {

@override
Widget displayAlbum(BuildContext context) {
return AnimatedSwitcher(
duration: const Duration(milliseconds: 250),
child: Center(
return Column(
children: [
const SizedBox(height: 16),
Center(
child: SizedBox(
width: MediaQuery.of(context).size.width - 32,
height: MediaQuery.of(context).size.height / 2,
Expand Down Expand Up @@ -161,6 +162,8 @@ class DisplayAlbumAsCard extends DisplayAlbum {
))
],
))),
));
),
],
);
}
}
51 changes: 28 additions & 23 deletions lib/albumCard/display_as_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,34 @@ class DisplayAsList extends DisplayAlbum {

@override
Widget displayAlbum(BuildContext context) {
return ListTile(
leading: album.cover == 'assets/default.png'
? Image.asset(
album.cover,
fit: BoxFit.fitWidth,
)
: Image.network(
album.cover,
fit: BoxFit.fitWidth,
),
title: Text(album.name),
subtitle: Text(album.artist),
trailing: Text(
(dateIsToday(date))
? "today"
: (dateIsYesterday(date))
? "yesterday"
: "${date.day}/${date.month}/${date.year}",
style: Theme.of(context).textTheme.labelSmall,
textAlign: TextAlign.right,
),
style: ListTileStyle.list,
isThreeLine: true,
return Column(
children: [
ListTile(
leading: album.cover == 'assets/default.png'
? Image.asset(
album.cover,
fit: BoxFit.fitWidth,
)
: Image.network(
album.cover,
fit: BoxFit.fitWidth,
),
title: Text(album.name),
subtitle: Text(album.artist),
trailing: Text(
(dateIsToday(date))
? "today"
: (dateIsYesterday(date))
? "yesterday"
: "${date.day}/${date.month}/${date.year}",
style: Theme.of(context).textTheme.labelSmall,
textAlign: TextAlign.right,
),
style: ListTileStyle.list,
isThreeLine: true,
),
const Divider(indent: 16.0, endIndent: 16.0)
],
);
}
}
2 changes: 0 additions & 2 deletions lib/route/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class _MyHomePageState extends State<MyHomePage> {
// than having to individually change instances of widgets.
DateTime timeNow = DateTime.now();
List<Widget> albumCards = [
const SizedBox(height: 16),
AlbumCard(date: timeNow, isCard: isCard),
];

Expand All @@ -64,7 +63,6 @@ class _MyHomePageState extends State<MyHomePage> {

while (date.isAfter(deadline)) {
date = DateTime(date.year, date.month, date.day - 1);
albumCards.add(const SizedBox(height: 13));
albumCards.add(AlbumCard(
date: date,
isCard: isCard,
Expand Down

0 comments on commit be86313

Please sign in to comment.