Skip to content

Commit

Permalink
feat: show album release year (#387) and fix layout of artist's album
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingkor Roy Tirtho committed Apr 27, 2023
1 parent 623d171 commit 6a6ddf6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 29 deletions.
49 changes: 25 additions & 24 deletions lib/components/artist/artist_album_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,36 @@ class ArtistAlbumList extends HookConsumerWidget {
? false
: (albumsQuery.pages.last.items?.length ?? 0) == 5;

return SizedBox(
height: 300,
child: ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
),
child: Scrollbar(
interactive: false,
controller: scrollController,
child: Waypoint(
return Column(
children: [
ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
),
child: Scrollbar(
interactive: false,
controller: scrollController,
onTouchEdge: albumsQuery.fetchNext,
child: ListView.builder(
itemCount: albums.length,
child: Waypoint(
controller: scrollController,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
if (index == albums.length - 1 && hasNextPage) {
return const ShimmerPlaybuttonCard(count: 1);
}
return AlbumCard(albums[index]);
},
onTouchEdge: albumsQuery.fetchNext,
child: SingleChildScrollView(
controller: scrollController,
scrollDirection: Axis.horizontal,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...albums.map((album) => AlbumCard(album)),
if (hasNextPage) const ShimmerPlaybuttonCard(count: 1),
],
),
),
),
),
),
),
],
);
}
}
12 changes: 12 additions & 0 deletions lib/components/shared/track_table/track_collection_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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!,
Expand Down
10 changes: 5 additions & 5 deletions lib/pages/artist/artist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
),
),
Expand All @@ -142,7 +143,7 @@ class ArtistPage extends HookConsumerWidget {
BorderRadius.circular(50)),
child: Text(
"Blacklisted",
style: chipTextVariant?.copyWith(
style: chipTextVariant.copyWith(
color: Colors.white,
),
),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6a6ddf6

Please sign in to comment.