feat: show album release year (#387) and fix layout of artist's album

This commit is contained in:
Kingkor Roy Tirtho 2023-04-27 23:00:27 +06:00
parent 623d171d79
commit 6a6ddf6e1f
3 changed files with 42 additions and 29 deletions

View File

@ -33,9 +33,9 @@ class ArtistAlbumList extends HookConsumerWidget {
? false
: (albumsQuery.pages.last.items?.length ?? 0) == 5;
return SizedBox(
height: 300,
child: ScrollConfiguration(
return Column(
children: [
ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
@ -48,20 +48,21 @@ class ArtistAlbumList extends HookConsumerWidget {
child: Waypoint(
controller: scrollController,
onTouchEdge: albumsQuery.fetchNext,
child: ListView.builder(
itemCount: albums.length,
child: SingleChildScrollView(
controller: scrollController,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
if (index == albums.length - 1 && hasNextPage) {
return const ShimmerPlaybuttonCard(count: 1);
}
return AlbumCard(albums[index]);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...albums.map((album) => AlbumCard(album)),
if (hasNextPage) const ShimmerPlaybuttonCard(count: 1),
],
),
),
),
),
),
],
);
}
}

View File

@ -7,6 +7,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/collections/assets.gen.dart';
import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/album/album_card.dart';
import 'package:spotube/components/shared/compact_search.dart';
import 'package:spotube/components/shared/shimmers/shimmer_track_tile.dart';
import 'package:spotube/components/shared/page_window_title_bar.dart';
@ -284,6 +285,17 @@ class TrackCollectionView<T> extends HookConsumerWidget {
fontWeight: FontWeight.w600,
),
),
if (album != null)
Text(
"${AlbumType.from(album?.albumType).formatted} • Released • ${DateTime.tryParse(
album?.releaseDate ?? "",
)?.year}",
style:
theme.textTheme.titleMedium!.copyWith(
color: color?.titleTextColor,
fontWeight: FontWeight.normal,
),
),
if (description != null)
Text(
description!,

View File

@ -34,6 +34,7 @@ class ArtistPage extends HookConsumerWidget {
SpotifyApi spotify = ref.watch(spotifyProvider);
final parentScrollController = useScrollController();
final theme = Theme.of(context);
final scaffoldMessenger = ScaffoldMessenger.of(context);
final textTheme = theme.textTheme;
final chipTextVariant = useBreakpointValue(
sm: textTheme.bodySmall,
@ -126,7 +127,7 @@ class ArtistPage extends HookConsumerWidget {
BorderRadius.circular(50)),
child: Text(
data.type!.toUpperCase(),
style: chipTextVariant?.copyWith(
style: chipTextVariant.copyWith(
color: Colors.white,
),
),
@ -142,7 +143,7 @@ class ArtistPage extends HookConsumerWidget {
BorderRadius.circular(50)),
child: Text(
"Blacklisted",
style: chipTextVariant?.copyWith(
style: chipTextVariant.copyWith(
color: Colors.white,
),
),
@ -262,8 +263,7 @@ class ArtistPage extends HookConsumerWidget {
text: data.externalUrls?.spotify),
);
ScaffoldMessenger.of(context)
.showSnackBar(
scaffoldMessenger.showSnackBar(
const SnackBar(
width: 300,
behavior: SnackBarBehavior.floating,
@ -334,7 +334,7 @@ class ArtistPage extends HookConsumerWidget {
),
onPressed: () {
playlistNotifier.add(topTracks.toList());
ScaffoldMessenger.of(context).showSnackBar(
scaffoldMessenger.showSnackBar(
SnackBar(
width: 300,
behavior: SnackBarBehavior.floating,