Do not switch chapters if the current chapter is the first or last chapter in the chapter group.

This commit is contained in:
2025-02-21 14:13:05 +08:00
parent bf51cd5cee
commit a014587a94
4 changed files with 41 additions and 8 deletions

View File

@@ -265,6 +265,40 @@ class _ReaderState extends State<Reader>
});
}
}
bool get isFirstChapterOfGroup {
if (widget.chapters?.isGrouped ?? false) {
int c = chapter - 1;
int g = 1;
while (c > 0) {
c -= widget.chapters!.getGroupByIndex(g - 1).length;
g++;
}
if (c == 0) {
return true;
} else {
return false;
}
}
return chapter == 1;
}
bool get isLastChapterOfGroup {
if (widget.chapters?.isGrouped ?? false) {
int c = chapter;
int g = 1;
while (c > 0) {
c -= widget.chapters!.getGroupByIndex(g - 1).length;
g++;
}
if (c == 0) {
return true;
} else {
return false;
}
}
return chapter == maxChapter;
}
}
abstract mixin class _ImagePerPageHandler {