Skip to content

Commit

Permalink
✨ Redesign track list tile (#829)
Browse files Browse the repository at this point in the history
* started redesigning track list tile

* improved list tile dismissible behavior and design

* highlight current track, including mini visualizer

- also removed old list tile code

* use current accent color to highlight playing track

- hopefully this doesn't have a huge performance impact...

* track tile contrast and layout tweaks

* use track list tile on playback history

* use AddToPlaylistButton instead of FavoriteButton

* fix color of favorite/playlist button on track list tile

* adjust font size of artist span

* simplify track list tile widgets to improve performance

- also gets rid of duplicate gesture detectors and fixes incorrect menu themes

* merge upstream

* only show tile background for current track

- also wait with applying the theme until accent color is available

* tile layout adjustments

* show album, tweak text styles

* fix visual bugs

* fix wrong cover and theme for AddToPlaylistButton

* port new list tile to queue list

- some edge cases might still be missing, and refactoring to using constructors instead of separate classed would be good

* refactor track list tiles and fix theme issues

* show list indices, hide covers, show & hide extra info where appropriate

* show artist by default

* fix auto-generated files

* use new track list tile for Next Up and previous tracks, remove old queue list tile

* added setting for optionally showing album covers on album screen

* only apply cover on album screen setting to album screen list tiles

* accessibility improvements

* remove mini visualizer, tint title

- the visualizer doesn't fit in well and isn't needed to mark the current track anymore
- the fully-saturated accent color looked a bit strange

* remove mini visualizer dependencies

* don't block for dismiss gestures

* fix covers hidden on non-album screens

* remove `hideSongArtistsIfSameAsAlbumArtists` setting

- doesn't work well with new track list tile
- other apps also show the artist always (Spotify, YT Music)

* use `colorThemeProvider` for tile accent color
- uses Finamp's blue as a fallback until the correct accent color has been calculated
- avoids pulsing/flashing effect on theme change

* increase track title highlight

* add download & lyrics indicators

- also adjusted download indicator icons and size

* get rid of unneeded widget and AnimatedTheme

* improve title contrast in dark mode, fix opacity

* fix title characters getting cut off

* disable dismissible on tab view

* re-enable dismissing queue items

* fix tile color on queue

* fix fallbacks for indices and artists

* try to fix fade effect on artist overflow

* use SliverFixedExtentList on album screen

* fix -1 index

* don't highlight some track list tiles

* improve alphabet list padding
  • Loading branch information
Chaphasilor authored Nov 11, 2024
1 parent 672e7ac commit c9e256f
Show file tree
Hide file tree
Showing 21 changed files with 1,068 additions and 831 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import 'package:finamp/models/jellyfin_models.dart';
import 'package:finamp/services/favorite_provider.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:finamp/services/finamp_settings_helper.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:get_it/get_it.dart';

import 'playlist_actions_menu.dart';

Expand All @@ -35,6 +37,8 @@ class AddToPlaylistButton extends ConsumerStatefulWidget {
}

class _AddToPlaylistButtonState extends ConsumerState<AddToPlaylistButton> {
final _queueService = GetIt.instance<QueueService>();

@override
Widget build(BuildContext context) {
if (widget.item == null) {
Expand Down Expand Up @@ -74,12 +78,14 @@ class _AddToPlaylistButtonState extends ConsumerState<AddToPlaylistButton> {
}

bool inPlaylist = queueItemInPlaylist(widget.queueItem);
final currentTrack = _queueService.getCurrentTrack()?.baseItem;
await showPlaylistActionsMenu(
context: context,
item: widget.item!,
parentPlaylist:
inPlaylist ? widget.queueItem!.source.item : null,
usePlayerTheme: true,
usePlayerTheme: widget.item?.blurHash != null &&
widget.item?.blurHash == currentTrack?.blurHash,
);
}),
),
Expand Down
30 changes: 9 additions & 21 deletions lib/components/AlbumScreen/album_screen_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '../../services/finamp_settings_helper.dart';
import 'album_screen_content_flexible_space_bar.dart';
import 'download_button.dart';
import 'playlist_name_edit_button.dart';
import 'song_list_tile.dart';
import 'track_list_tile.dart';

typedef BaseItemDtoCallback = void Function(BaseItemDto item);

Expand Down Expand Up @@ -175,7 +175,10 @@ class _SongsSliverListState extends State<SongsSliverList> {
),
);
}
return SliverList(
return SliverFixedExtentList(
itemExtent: TrackListItemTile.defaultTileHeight +
TrackListItemTile.defaultTitleGap,
// return SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
// When user selects song from disc other than first, index number is
Expand All @@ -197,10 +200,13 @@ class _SongsSliverListState extends State<SongsSliverList> {
return item;
}

return SongListTile(
return TrackListTile(
item: item,
children: widget.childrenForQueue,
index: indexOffset,
showIndex: item.albumId == widget.parent.id,
showCover: item.albumId != widget.parent.id ||
FinampSettingsHelper.finampSettings.showCoversOnAlbumScreen,
parentItem: widget.parent,
onRemoveFromList: () {
final item = removeItem();
Expand All @@ -210,24 +216,6 @@ class _SongsSliverListState extends State<SongsSliverList> {
},
isInPlaylist: widget.parent.type == "Playlist",
isOnArtistScreen: widget.isOnArtistScreen,
// 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,
);
},
Expand Down
15 changes: 10 additions & 5 deletions lib/components/AlbumScreen/downloaded_indicator.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_tabler_icons/flutter_tabler_icons.dart';
import 'package:get_it/get_it.dart';

import '../../models/finamp_models.dart';
Expand Down Expand Up @@ -30,22 +31,26 @@ class DownloadedIndicator extends ConsumerWidget {
case DownloadItemState.downloading:
case DownloadItemState.needsRedownload:
return Icon(
Icons.download_outlined,
color: Colors.grey.withOpacity(0.5),
TablerIcons.cloud_download,
color: Theme.of(context)
.textTheme
.bodyMedium!
.color
?.withOpacity(0.75),
size: size,
);
case DownloadItemState.failed:
case DownloadItemState.syncFailed:
return Icon(
Icons.error,
TablerIcons.download_off,
color: Colors.red,
size: size,
);
case DownloadItemState.complete:
case DownloadItemState.needsRedownloadComplete:
return Icon(
Icons.download,
color: Theme.of(context).colorScheme.secondary,
TablerIcons.device_sd_card,
color: Theme.of(context).textTheme.bodyMedium!.color,
size: size,
);
}
Expand Down
Loading

0 comments on commit c9e256f

Please sign in to comment.