mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-17 23:09:36 +00:00
fix: 优化播放页面章节列表
This commit is contained in:
parent
0a26871bb1
commit
612e8b3f50
7 changed files with 96 additions and 153 deletions
|
|
@ -152,9 +152,9 @@ class PlayerState extends _$PlayerState {
|
|||
}
|
||||
|
||||
@riverpod
|
||||
Duration? currentTime(Ref ref, String libraryItemId) {
|
||||
final me = ref.watch(meProvider);
|
||||
final userProgress = me.valueOrNull?.mediaProgress
|
||||
Future<Duration?> currentTime(Ref ref, String libraryItemId) async {
|
||||
final me = await ref.watch(meProvider.future);
|
||||
final userProgress = me.mediaProgress
|
||||
?.firstWhereOrNull((element) => element.libraryItemId == libraryItemId);
|
||||
return userProgress?.currentTime;
|
||||
}
|
||||
|
|
@ -192,7 +192,8 @@ class CurrentBook extends _$CurrentBook {
|
|||
}
|
||||
final book = await ref.read(libraryItemProvider(libraryItemId).future);
|
||||
state = book.media.asBookExpanded;
|
||||
final currentTime = ref.read(currentTimeProvider(libraryItemId));
|
||||
final currentTime =
|
||||
await ref.read(currentTimeProvider(libraryItemId).future);
|
||||
await ref
|
||||
.read(absPlayerProvider.notifier)
|
||||
.load(state!, initialPosition: currentTime, play: play);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue