admin管理员组文章数量:1287579
I am developing a personal book store app and need a reliable EPUB reader. After testing multiple options, I found CosmosEpub to be the best solution for my needs. However, I encountered an issue where CosmosEpub correctly restores the last read chapter, but it does not restore the exact page within that chapter when reopening a book. Instead, it always starts at the first page of the chapter.
Expected Behavior
- ✅ Restore both chapter and last read page when reopening a book.
- ❌ Currently, it only restores the chapter but starts from page 1 of that chapter.
Code Sample
Future<void> _openEpubReader() async {
try {
print('Fetching book progress...');
BookProgressModel? bookProgress = await CosmosEpub.getBookProgress(widget.bookTitle);
int startChapterIndex = bookProgress?.currentChapterIndex ?? 0;
int startPageIndex = bookProgress?.currentPageIndex ?? 0;
await CosmosEpub.setCurrentPageIndex(widget.bookTitle, startPageIndex);
await CosmosEpub.setCurrentChapterIndex(widget.bookTitle, startChapterIndex);
print('Opening local EPUB book...');
await CosmosEpub.openLocalBook(
localPath: widget.filePath,
context: context,
bookId: widget.bookTitle,
starterChapter: startChapterIndex,
onPageFlip: (int currentPage, int totalPages) {
CosmosEpub.setCurrentPageIndex(widget.bookTitle, currentPage);
},
);
} catch (e) {
print('Error opening EPUB: $e');
}
}
Steps to Reproduce
- Open a book, read a few pages, then close it.
- Reopen the book.
- The book opens at the correct chapter, but always from page 1 of that chapter.
Tested On
- Flutter Version: 3.27.4 (Stable)
- Dart Version: 3.6.2
- CosmosEpub Version: 0.0.2
- Devices: Tested on multiple Android devices (same issue on all).
Is there a way to restore both chapter and page on reopen? Thanks for the great work!
本文标签: flutter dependenciesCosmosEpub Does Not Restore Last Read Page (Only Restores Chapter)Stack Overflow
版权声明:本文标题:flutter dependencies - CosmosEpub Does Not Restore Last Read Page (Only Restores Chapter) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741276000a2369731.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论