Skip to content

Commit

Permalink
add download & lyrics indicators
Browse files Browse the repository at this point in the history
- also adjusted download indicator icons and size
  • Loading branch information
Chaphasilor committed Nov 9, 2024
1 parent d50e47b commit 44fa8c8
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 54 deletions.
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
135 changes: 86 additions & 49 deletions lib/components/AlbumScreen/track_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 ??
Expand All @@ -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,
),
),
]),
),
),
],
Expand Down

0 comments on commit 44fa8c8

Please sign in to comment.