yaml
This commit is contained in:
parent
d205277cdd
commit
d1cab09a4f
9 changed files with 850 additions and 140 deletions
|
|
@ -2,12 +2,14 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:just_audio/just_audio.dart' show LoopMode;
|
||||
|
||||
import '../downloads/download_manager.dart';
|
||||
import '../playback/playback_engine.dart';
|
||||
import '../state/providers.dart';
|
||||
import '../subsonic/models.dart';
|
||||
import '../theme/tokens.dart';
|
||||
import '../widgets/block_progress_bar.dart';
|
||||
import '../widgets/hairline_panel.dart';
|
||||
import 'add_to_playlist_sheet.dart';
|
||||
|
||||
/// Now Playing tab — album art + info strip + transport, bound to the live
|
||||
/// playback engine. The top region shows the full-size album art by default and
|
||||
|
|
@ -249,6 +251,12 @@ class _FavRating extends ConsumerWidget {
|
|||
final rating =
|
||||
fav.ratingFor(song.id) != 0 ? fav.ratingFor(song.id) : (song.userRating ?? 0);
|
||||
|
||||
final downloadStatus =
|
||||
ref.watch(downloadManagerProvider.select((s) => s.byId[song.id]?.status));
|
||||
final isDownloaded = downloadStatus == DownloadStatus.done;
|
||||
final isDownloading = downloadStatus == DownloadStatus.queued ||
|
||||
downloadStatus == DownloadStatus.downloading;
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
InkWell(
|
||||
|
|
@ -278,6 +286,41 @@ class _FavRating extends ConsumerWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
InkWell(
|
||||
onTap: () => showAddToPlaylistSheet(context, songs: [song]),
|
||||
customBorder: const CircleBorder(),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(RatuneSpacing.sm),
|
||||
child: Icon(Icons.playlist_add,
|
||||
size: 22, color: RatuneColors.dimmed),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: isDownloading
|
||||
? null
|
||||
: () {
|
||||
final dm = ref.read(downloadManagerProvider.notifier);
|
||||
isDownloaded ? dm.remove(song.id) : dm.download(song);
|
||||
},
|
||||
customBorder: const CircleBorder(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(RatuneSpacing.sm),
|
||||
child: isDownloading
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: Icon(
|
||||
isDownloaded
|
||||
? Icons.download_done
|
||||
: Icons.download_outlined,
|
||||
size: 22,
|
||||
color: isDownloaded ? accent : RatuneColors.dimmed,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue