mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 06:19:35 +00:00
修复章节列表滚动 在windows平台报错
This commit is contained in:
parent
620a1eb7a2
commit
05bc0cde74
7 changed files with 32 additions and 12 deletions
|
|
@ -165,7 +165,7 @@ class AudiobookPlayerPlayPauseButton extends HookConsumerWidget {
|
|||
),
|
||||
ProcessingState.completed => IconButton(
|
||||
onPressed: () async {
|
||||
await player.seek(const Duration(seconds: 0));
|
||||
await player.seekInBook(const Duration(seconds: 0));
|
||||
await player.play();
|
||||
},
|
||||
icon: const Icon(
|
||||
|
|
@ -220,7 +220,7 @@ class AudiobookChapterProgressBar extends HookConsumerWidget {
|
|||
: currentChapter.end - currentChapter.start,
|
||||
// ! TODO add onSeek
|
||||
onSeek: (duration) {
|
||||
player.seek(
|
||||
player.seekInBook(
|
||||
duration + (currentChapter?.start ?? const Duration(seconds: 0)),
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ class PlayerWhenExpanded extends HookConsumerWidget {
|
|||
|
||||
// the chapter skip buttons, seek 30 seconds back and forward, and play/pause button
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Opacity(
|
||||
opacity: earlyPercentage,
|
||||
child: SizedBox(
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ class AudiobookPlayerSeekButton extends HookConsumerWidget {
|
|||
),
|
||||
onPressed: () {
|
||||
if (isForward) {
|
||||
player.seek(player.positionInBook + const Duration(seconds: 30));
|
||||
player.seek(player.position + const Duration(seconds: 30));
|
||||
} else {
|
||||
player.seek(player.positionInBook - const Duration(seconds: 30));
|
||||
player.seek(player.position - const Duration(seconds: 30));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class AudiobookPlayerSeekChapterButton extends HookConsumerWidget {
|
|||
}
|
||||
// if chapter does not exist, go to the start or end of the book
|
||||
if (player.currentChapter == null) {
|
||||
player.seek(isForward ? player.book!.duration : Duration.zero);
|
||||
player.seekInBook(isForward ? player.book!.duration : Duration.zero);
|
||||
return;
|
||||
}
|
||||
if (isForward) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class ChapterSelectionModal extends HookConsumerWidget {
|
|||
key: isCurrent ? chapterKey : null,
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
notifier.seek(chapter.start + 90.ms);
|
||||
notifier.seekInBook(chapter.start + 90.ms);
|
||||
notifier.play();
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue