mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 14:29:35 +00:00
媒体库上拉刷新,下拉加载
This commit is contained in:
parent
bdd85efcd8
commit
ebcbe1774a
20 changed files with 351 additions and 126 deletions
|
|
@ -88,6 +88,8 @@ class AbsPlayer extends _$AbsPlayer {
|
|||
final api = ref.read(authenticatedApiProvider);
|
||||
|
||||
final downloadManager = ref.read(simpleDownloadManagerProvider);
|
||||
print(downloadManager.basePath);
|
||||
|
||||
final libItem =
|
||||
await ref.read(libraryItemProvider(book.libraryItemId).future);
|
||||
final downloadedUris = await downloadManager.getDownloadedFilesUri(libItem);
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ final currentChaptersProvider =
|
|||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef CurrentChaptersRef = AutoDisposeProviderRef<List<api.BookChapter>>;
|
||||
String _$absPlayerHash() => r'74a59dbf0f9396fef6bb60363fb186f5e4619a63';
|
||||
String _$absPlayerHash() => r'e682fea03793a0370cb143602980d5c1e37396c7';
|
||||
|
||||
/// 音频播放器 riverpod状态
|
||||
///
|
||||
|
|
|
|||
|
|
@ -90,32 +90,41 @@ class ChapterSelectionModal extends HookConsumerWidget {
|
|||
final chapter = book.chapters[index];
|
||||
final isCurrent = currentChapter.id == chapter.id;
|
||||
final isPlayed = index < initialIndex;
|
||||
return ListTile(
|
||||
autofocus: isCurrent,
|
||||
iconColor: isPlayed && !isCurrent ? theme.disabledColor : null,
|
||||
title: Text(
|
||||
chapter.title,
|
||||
style: isPlayed && !isCurrent
|
||||
? TextStyle(color: theme.disabledColor)
|
||||
: null,
|
||||
return Container(
|
||||
// 自定义autofocus,防止autofocus出现在其他组件底层
|
||||
decoration: isCurrent
|
||||
? BoxDecoration(
|
||||
color: Theme.of(context).focusColor, // 背景色
|
||||
)
|
||||
: null,
|
||||
child: ListTile(
|
||||
// autofocus: isCurrent,
|
||||
iconColor:
|
||||
isPlayed && !isCurrent ? theme.disabledColor : null,
|
||||
title: Text(
|
||||
chapter.title,
|
||||
style: isPlayed && !isCurrent
|
||||
? TextStyle(color: theme.disabledColor)
|
||||
: null,
|
||||
),
|
||||
subtitle: Text(
|
||||
'(${chapter.duration.smartBinaryFormat})',
|
||||
style: isPlayed && !isCurrent
|
||||
? TextStyle(color: theme.disabledColor)
|
||||
: null,
|
||||
),
|
||||
trailing: isCurrent
|
||||
? const PlayingIndicatorIcon()
|
||||
: const Icon(Icons.play_arrow),
|
||||
selected: isCurrent,
|
||||
onTap: () {
|
||||
if (back) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
ref.read(absPlayerProvider).switchChapter(chapter.id);
|
||||
}
|
||||
},
|
||||
),
|
||||
subtitle: Text(
|
||||
'(${chapter.duration.smartBinaryFormat})',
|
||||
style: isPlayed && !isCurrent
|
||||
? TextStyle(color: theme.disabledColor)
|
||||
: null,
|
||||
),
|
||||
trailing: isCurrent
|
||||
? const PlayingIndicatorIcon()
|
||||
: const Icon(Icons.play_arrow),
|
||||
selected: isCurrent,
|
||||
onTap: () {
|
||||
if (back) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
ref.read(absPlayerProvider).switchChapter(chapter.id);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue