mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-07 19:49:29 +00:00
Refactor chapter seeking logic in AudiobookPlayerSeekChapterButton
This commit is contained in:
parent
aefe5299ca
commit
73e8f4bfa6
7 changed files with 217 additions and 96 deletions
|
|
@ -225,6 +225,10 @@ class AudiobookPlayer extends AudioPlayer {
|
|||
if (_book == null) {
|
||||
return null;
|
||||
}
|
||||
// if the list is empty, return null
|
||||
if (_book!.chapters.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
return _book!.chapters.firstWhere(
|
||||
(element) {
|
||||
return element.start <= positionInBook && element.end >= positionInBook;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue