Skip to content

Commit

Permalink
revert unneeded changes to albumScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiefseetauchner committed Dec 11, 2023
1 parent b34526f commit c92f472
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 35 deletions.
42 changes: 17 additions & 25 deletions lib/components/AlbumScreen/album_screen_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,13 @@ class SongsSliverList extends StatefulWidget {
required this.childrenForList,
required this.childrenForQueue,
required this.parent,
this.showPlayCount = false,
this.onDelete,
}) : super(key: key);

final List<BaseItemDto> childrenForList;
final List<BaseItemDto> childrenForQueue;
final BaseItemDto parent;
final BaseItemDtoCallback? onDelete;
final bool showPlayCount;

@override
State<SongsSliverList> createState() => _SongsSliverListState();
Expand All @@ -149,15 +147,15 @@ class _SongsSliverListState extends State<SongsSliverList> {

@override
Widget build(BuildContext context) {
// When user selects song from disc other than first, index number is
// incorrect and song with the same index on first disc is played instead.
// Adding this offset ensures playback starts for nth song on correct disc.
final int indexOffset =
widget.childrenForQueue.indexOf(widget.childrenForList[0]);

return SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
// When user selects song from disc other than first, index number is
// incorrect and song with the same index on first disc is played instead.
// Adding this offset ensures playback starts for nth song on correct disc.
final indexOffset =
widget.childrenForQueue.indexOf(widget.childrenForList[0]);

final BaseItemDto item = widget.childrenForList[index];

BaseItemDto removeItem() {
Expand Down Expand Up @@ -185,23 +183,17 @@ class _SongsSliverListState extends State<SongsSliverList> {
isInPlaylist: widget.parent.type == "Playlist",
// show artists except for this one scenario
showArtists: !(
// we're on album screen
widget.parent.type == "MusicAlbum"
// "hide song artists if they're the same as album artists" == true
&&
FinampSettingsHelper
.finampSettings.hideSongArtistsIfSameAsAlbumArtists
// song artists == album artists
&&
setEquals(
widget.parent.albumArtists
?.map((e) => e.name)
.toSet(),
item.artists?.toSet()))
// hide song artist if on the artist screen
&&
widget.parent.type != "MusicArtist",
showPlayCount: widget.showPlayCount,
// we're on album screen
widget.parent.type == "MusicAlbum"
// "hide song artists if they're the same as album artists" == true
&&
FinampSettingsHelper
.finampSettings.hideSongArtistsIfSameAsAlbumArtists
// song artists == album artists
&&
setEquals(
widget.parent.albumArtists?.map((e) => e.name).toSet(),
item.artists?.toSet())),
);
},
childCount: widget.childrenForList.length,
Expand Down
11 changes: 1 addition & 10 deletions lib/components/AlbumScreen/song_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class SongListTile extends StatefulWidget {
this.parentName,
this.isSong = false,
this.showArtists = true,
this.showPlayCount = false,
this.onDelete,

/// Whether this widget is being displayed in a playlist. If true, will show
Expand All @@ -66,7 +65,6 @@ class SongListTile extends StatefulWidget {
final String? parentId;
final String? parentName;
final bool showArtists;
final bool showPlayCount;
final VoidCallback? onDelete;
final bool isInPlaylist;

Expand Down Expand Up @@ -177,12 +175,6 @@ class _SongListTileState extends State<SongListTile> {
text:
" · ${processArtist(widget.item.artists?.join(", ") ?? widget.item.albumArtist, context)}",
style: TextStyle(color: Theme.of(context).disabledColor),
),
if (widget.showPlayCount)
TextSpan(
text: AppLocalizations.of(context)!
.playCountInline(widget.item.userData?.playCount ?? 0),
style: TextStyle(color: Theme.of(context).disabledColor),
)
],
),
Expand Down Expand Up @@ -491,8 +483,7 @@ class _SongListTileState extends State<SongListTile> {
if (!mounted) return false;

ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(AppLocalizations.of(context)!
.confirmAddToNextUp("track")),
content: Text(AppLocalizations.of(context)!.confirmAddToNextUp("track")),
));

return false;
Expand Down

0 comments on commit c92f472

Please sign in to comment.