From 7b601058ebc0f1900b4ac35f71f564a681db7131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=92=E7=A0=82=E7=B3=96?= <90336521+lings03@users.noreply.github.com> Date: Fri, 21 Feb 2025 09:12:53 +0800 Subject: [PATCH] Change history of page and maxPage (#216) --- lib/pages/reader/reader.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/pages/reader/reader.dart b/lib/pages/reader/reader.dart index 9cf2bc5..17d68e3 100644 --- a/lib/pages/reader/reader.dart +++ b/lib/pages/reader/reader.dart @@ -258,9 +258,15 @@ class _ReaderState extends State with _ReaderLocation, _ReaderWindow { void updateHistory() { if (history != null) { - history!.page = page; + if(page == maxPage){ + /// Record the last image of chapter + history!.page = images?.length ?? 1; + } else { + /// Record the first image of the page + history!.page = (page-1) * imagesPerPage + 1; + } if (maxPage > 1) { - history!.maxPage = maxPage; + history!.maxPage = images?.length ?? 1; } if (widget.chapters?.isGrouped ?? false) { int g = 0;