epub阅读+关联书籍

This commit is contained in:
DelLevin-Home
2026-06-27 18:13:34 +08:00
parent d54e33e4cf
commit bcff4f6c01
15 changed files with 1143 additions and 124 deletions

View File

@@ -15,6 +15,8 @@ mixin _SpineNavigationMixin on State<ReaderScreen> {
int get currentPageInChapter;
set currentPageInChapter(int v);
int get totalPagesInChapter;
// === Cross-mixin: _ProgressMixin ===
void updateProgressDebounced();
void saveProgress();
@@ -46,6 +48,7 @@ mixin _SpineNavigationMixin on State<ReaderScreen> {
double? restoreScrollRatio,
}) async {
if (bookSession.spine.isEmpty) return;
if (currentSpineItemIndex < 0) currentSpineItemIndex = 0;
if (mounted) {
setState(() {
isWebViewLoading = true;
@@ -144,7 +147,11 @@ mixin _SpineNavigationMixin on State<ReaderScreen> {
updateProgressDebounced();
await loadCarousel(anchor: anchor);
saveProgress();
bookSession.flushProgress(
currentChapterIndex: currentSpineItemIndex,
currentPageInChapter: currentPageInChapter,
totalPagesInChapter: totalPagesInChapter,
);
}
Future<void> previousSpineItem() async {
@@ -160,7 +167,11 @@ mixin _SpineNavigationMixin on State<ReaderScreen> {
});
preloadPreviousOf(currentSpineItemIndex);
saveProgress();
bookSession.flushProgress(
currentChapterIndex: currentSpineItemIndex,
currentPageInChapter: currentPageInChapter,
totalPagesInChapter: totalPagesInChapter,
);
}
Future<void> previousSpineItemFirstPage() async {
@@ -178,7 +189,11 @@ mixin _SpineNavigationMixin on State<ReaderScreen> {
updateProgressDebounced();
preloadPreviousOf(currentSpineItemIndex);
saveProgress();
bookSession.flushProgress(
currentChapterIndex: currentSpineItemIndex,
currentPageInChapter: currentPageInChapter,
totalPagesInChapter: totalPagesInChapter,
);
}
Future<void> nextSpineItem() async {
@@ -196,7 +211,11 @@ mixin _SpineNavigationMixin on State<ReaderScreen> {
updateProgressDebounced();
preloadNextOf(currentSpineItemIndex);
saveProgress();
bookSession.flushProgress(
currentChapterIndex: currentSpineItemIndex,
currentPageInChapter: currentPageInChapter,
totalPagesInChapter: totalPagesInChapter,
);
}
Future<void> navigateToTocItem(TocEntry item) async {