Fix invalid total page count. Close #348

This commit is contained in:
2025-04-28 20:18:29 +08:00
parent 929c1a9d91
commit bf7b90313a
2 changed files with 14 additions and 6 deletions

View File

@@ -111,7 +111,13 @@ class _ReaderState extends State<Reader>
}
@override
int get maxPage => ((images?.length ?? 1) / imagesPerPage).ceil();
int get maxPage {
if (!showSingleImageOnFirstPage) {
return (images!.length / imagesPerPage).ceil();
} else {
return 1 + ((images!.length - 1) / imagesPerPage).ceil();
}
}
ComicType get type => widget.type;
@@ -125,7 +131,8 @@ class _ReaderState extends State<Reader>
late ReaderMode mode;
@override
bool get isPortrait => MediaQuery.of(context).orientation == Orientation.portrait;
bool get isPortrait =>
MediaQuery.of(context).orientation == Orientation.portrait;
History? history;
@@ -343,6 +350,9 @@ abstract mixin class _ImagePerPageHandler {
}
}
bool get showSingleImageOnFirstPage =>
appdata.settings["showSingleImageOnFirstPage"];
/// The number of images displayed on one screen
int get imagesPerPage {
if (mode.isContinuous) return 1;