auto hide appbar and bottom bar when reading

This commit is contained in:
kodjomoustapha 2023-08-22 19:17:25 +01:00
parent b8343b6a37
commit e16190b0f4
4 changed files with 27 additions and 26 deletions

View file

@ -214,25 +214,27 @@ class ReaderController {
}
void setPageIndex(int newIndex) {
if (!incognitoMode) {
List<ChapterPageIndex>? chapterPageIndexs = [];
for (var chapterPageIndex
in getIsarSetting().chapterPageIndexList ?? []) {
if (chapterPageIndex.chapterId != chapter.id) {
chapterPageIndexs.add(chapterPageIndex);
if (!chapter.isRead!) {
if (!incognitoMode) {
List<ChapterPageIndex>? chapterPageIndexs = [];
for (var chapterPageIndex
in getIsarSetting().chapterPageIndexList ?? []) {
if (chapterPageIndex.chapterId != chapter.id) {
chapterPageIndexs.add(chapterPageIndex);
}
}
chapterPageIndexs.add(ChapterPageIndex()
..chapterId = chapter.id
..index = newIndex);
final chap = chapter;
isar.writeTxnSync(() {
isar.settings.putSync(
getIsarSetting()..chapterPageIndexList = chapterPageIndexs);
chap.isRead = (newIndex + 1) == getPageLength([]);
chap.lastPageRead = (newIndex + 1).toString();
isar.chapters.putSync(chap);
});
}
chapterPageIndexs.add(ChapterPageIndex()
..chapterId = chapter.id
..index = newIndex);
final chap = chapter;
isar.writeTxnSync(() {
isar.settings.putSync(
getIsarSetting()..chapterPageIndexList = chapterPageIndexs);
chap.isRead = (newIndex + 1) == getPageLength([]);
chap.lastPageRead = (newIndex + 1).toString();
isar.chapters.putSync(chap);
});
}
}

View file

@ -1175,6 +1175,9 @@ class _MangaChapterPageGalleryState
child: NotificationListener<UserScrollNotification>(
onNotification: (notification) {
if (notification.direction == ScrollDirection.idle) {
if (_isView) {
_isViewFunction();
}
_readerController.setMangaHistoryUpdate();
_readerController
.setPageIndex(_uChapDataPreload[_currentIndex!].index!);

View file

@ -60,11 +60,10 @@ packages:
background_downloader:
dependency: "direct main"
description:
path: "."
ref: dev
resolved-ref: "691b38d2ecc9ae76ca1ab3a05f16cb59062f3e5a"
url: "https://github.com/781flyingdutchman/background_downloader.git"
source: git
name: background_downloader
sha256: "3a2ddf08eeaa20723b5ddbb6a85c2568a9ba641e34cae5fc6a0300808a28581e"
url: "https://pub.dev"
source: hosted
version: "7.9.2"
boolean_selector:
dependency: transitive

View file

@ -30,10 +30,7 @@ dependencies:
google_fonts: ^5.1.0
url_launcher: ^6.1.12
package_info_plus: ^4.1.0
background_downloader:
git:
url: https://github.com/781flyingdutchman/background_downloader.git
ref: dev
background_downloader: ^7.9.2
permission_handler: ^10.4.3
flutter_inappwebview: ^5.7.2+3
draggable_menu: ^4.1.3