From 44fa8c82dbf392f0cf9ab9b5c14d9f702939d771 Mon Sep 17 00:00:00 2001 From: Chaphasilor Date: Sat, 9 Nov 2024 15:50:26 +0100 Subject: [PATCH] add download & lyrics indicators - also adjusted download indicator icons and size --- .../AlbumScreen/downloaded_indicator.dart | 15 +- .../AlbumScreen/track_list_tile.dart | 135 +++++++++++------- 2 files changed, 96 insertions(+), 54 deletions(-) diff --git a/lib/components/AlbumScreen/downloaded_indicator.dart b/lib/components/AlbumScreen/downloaded_indicator.dart index 94e819dcf..8cd3639c1 100644 --- a/lib/components/AlbumScreen/downloaded_indicator.dart +++ b/lib/components/AlbumScreen/downloaded_indicator.dart @@ -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'; @@ -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, ); } diff --git a/lib/components/AlbumScreen/track_list_tile.dart b/lib/components/AlbumScreen/track_list_tile.dart index 87c55e8f9..6c8123b72 100644 --- a/lib/components/AlbumScreen/track_list_tile.dart +++ b/lib/components/AlbumScreen/track_list_tile.dart @@ -737,6 +737,43 @@ class TrackListItemTile extends StatelessWidget { softWrap: false, maxLines: 1, TextSpan( + children: [ + WidgetSpan( + child: Padding( + padding: const EdgeInsets.only(right: 2.0), + child: Transform.translate( + offset: const Offset(-1.5, 2.5), + child: DownloadedIndicator( + item: DownloadStub.fromItem( + item: baseItem, type: DownloadItemType.song), + size: Theme.of(context) + .textTheme + .bodyMedium! + .fontSize! + + 1, + ), + ), + ), + alignment: PlaceholderAlignment.top, + ), + if (baseItem.hasLyrics ?? false) + WidgetSpan( + child: Padding( + padding: const EdgeInsets.only(right: 2.0), + child: Transform.translate( + offset: const Offset(-1.5, 2.5), + child: Icon( + TablerIcons.microphone_2, + size: Theme.of(context) + .textTheme + .bodyMedium! + .fontSize! + + 1, + )), + ), + alignment: PlaceholderAlignment.top, + ), + TextSpan( text: showArtists ? baseItem.artists?.join(", ") ?? baseItem.albumArtist ?? @@ -751,55 +788,55 @@ class TrackListItemTile extends StatelessWidget { fontSize: 13, fontWeight: FontWeight.w400, overflow: TextOverflow.ellipsis), - children: [ - if (!secondRowNeeded) - // show the artist anyway if nothing else is shown - TextSpan( - text: baseItem.artists?.join(", ") ?? - baseItem.albumArtist ?? - AppLocalizations.of(context)!.unknownArtist, - style: TextStyle( - color: Theme.of(context) - .textTheme - .bodyMedium! - .color! - .withOpacity(0.6), - fontSize: 13, - fontWeight: FontWeight.w300, - ), - ), - if (showArtists) - const WidgetSpan(child: SizedBox(width: 10.0)), - if (showAlbum) - TextSpan( - text: baseItem.album, - style: TextStyle( - color: Theme.of(context) - .textTheme - .bodyMedium! - .color! - .withOpacity(0.6), - fontSize: 13, - fontWeight: FontWeight.w300, - ), - ), - if (showAlbum) - const WidgetSpan(child: SizedBox(width: 10.0)), - if (showPlayCount) - TextSpan( - text: AppLocalizations.of(context)!.playCountValue( - baseItem.userData?.playCount ?? 0), - style: TextStyle( - color: Theme.of(context) - .textTheme - .bodyMedium! - .color! - .withOpacity(0.6), - fontSize: 13, - fontWeight: FontWeight.w300, - ), - ), - ]), + ), + if (!secondRowNeeded) + // show the artist anyway if nothing else is shown + TextSpan( + text: baseItem.artists?.join(", ") ?? + baseItem.albumArtist ?? + AppLocalizations.of(context)!.unknownArtist, + style: TextStyle( + color: Theme.of(context) + .textTheme + .bodyMedium! + .color! + .withOpacity(0.6), + fontSize: 13, + fontWeight: FontWeight.w300, + ), + ), + if (showArtists) + const WidgetSpan(child: SizedBox(width: 10.0)), + if (showAlbum) + TextSpan( + text: baseItem.album, + style: TextStyle( + color: Theme.of(context) + .textTheme + .bodyMedium! + .color! + .withOpacity(0.6), + fontSize: 13, + fontWeight: FontWeight.w300, + ), + ), + if (showAlbum) + const WidgetSpan(child: SizedBox(width: 10.0)), + if (showPlayCount) + TextSpan( + text: AppLocalizations.of(context)! + .playCountValue(baseItem.userData?.playCount ?? 0), + style: TextStyle( + color: Theme.of(context) + .textTheme + .bodyMedium! + .color! + .withOpacity(0.6), + fontSize: 13, + fontWeight: FontWeight.w300, + ), + ), + ]), ), ), ],