Added fullscreen mode for reader, code refactor

This commit is contained in:
kodjomoustapha 2024-01-28 16:49:22 +01:00
parent 3422076fa5
commit 792f8059a0
15 changed files with 712 additions and 551 deletions

View file

@ -282,5 +282,6 @@
"enable_auto_skip": "Enable auto skip",
"aniskip_button_timeout": "Button timeout",
"skip_opening": "Skip opening",
"skip_ending": "Skip ending"
"skip_ending": "Skip ending",
"fullscreen": "Fullscreen"
}

View file

@ -2,6 +2,7 @@ import 'dart:io';
import 'package:bot_toast/bot_toast.dart';
import 'package:desktop_webview_window/desktop_webview_window.dart';
import 'package:flex_color_scheme/flex_color_scheme.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
@ -52,7 +53,7 @@ void main(List<String> args) async {
}
// Initialize the Isar database.
isar = await StorageProvider().initDB(null);
isar = await StorageProvider().initDB(null, inspector: kDebugMode);
await StorageProvider().requestPermission();
// Start the app.

View file

@ -163,6 +163,8 @@ class Settings {
int? btServerPort;
bool? fullScreenReader;
Settings(
{this.id = 227,
this.displayType = DisplayType.compactGrid,
@ -234,7 +236,8 @@ class Settings {
this.enableAutoSkip,
this.aniSkipTimeoutLength,
this.btServerAddress = "127.0.0.1",
this.btServerPort});
this.btServerPort,
this.fullScreenReader = true});
Settings.fromJson(Map<String, dynamic> json) {
animatePageTransitions = json['animatePageTransitions'];
@ -362,6 +365,7 @@ class Settings {
aniSkipTimeoutLength = json['aniSkipTimeoutLength'];
btServerAddress = json['btServerAddress'];
btServerPort = json['btServerPort'];
fullScreenReader = json['fullScreenReader'];
}
Map<String, dynamic> toJson() => {
@ -457,7 +461,8 @@ class Settings {
'enableAutoSkip': enableAutoSkip,
'aniSkipTimeoutLength': aniSkipTimeoutLength,
'btServerAddress': btServerAddress,
'btServerPort': btServerPort
'btServerPort': btServerPort,
'fullScreenReader': fullScreenReader
};
}

View file

@ -224,185 +224,190 @@ const SettingsSchema = CollectionSchema(
name: r'flexSchemeColorIndex',
type: IsarType.long,
),
r'incognitoMode': PropertySchema(
r'fullScreenReader': PropertySchema(
id: 39,
name: r'fullScreenReader',
type: IsarType.bool,
),
r'incognitoMode': PropertySchema(
id: 40,
name: r'incognitoMode',
type: IsarType.bool,
),
r'libraryDownloadedChapters': PropertySchema(
id: 40,
id: 41,
name: r'libraryDownloadedChapters',
type: IsarType.bool,
),
r'libraryFilterAnimeBookMarkedType': PropertySchema(
id: 41,
id: 42,
name: r'libraryFilterAnimeBookMarkedType',
type: IsarType.long,
),
r'libraryFilterAnimeDownloadType': PropertySchema(
id: 42,
id: 43,
name: r'libraryFilterAnimeDownloadType',
type: IsarType.long,
),
r'libraryFilterAnimeStartedType': PropertySchema(
id: 43,
id: 44,
name: r'libraryFilterAnimeStartedType',
type: IsarType.long,
),
r'libraryFilterAnimeUnreadType': PropertySchema(
id: 44,
id: 45,
name: r'libraryFilterAnimeUnreadType',
type: IsarType.long,
),
r'libraryFilterMangasBookMarkedType': PropertySchema(
id: 45,
id: 46,
name: r'libraryFilterMangasBookMarkedType',
type: IsarType.long,
),
r'libraryFilterMangasDownloadType': PropertySchema(
id: 46,
id: 47,
name: r'libraryFilterMangasDownloadType',
type: IsarType.long,
),
r'libraryFilterMangasStartedType': PropertySchema(
id: 47,
id: 48,
name: r'libraryFilterMangasStartedType',
type: IsarType.long,
),
r'libraryFilterMangasUnreadType': PropertySchema(
id: 48,
id: 49,
name: r'libraryFilterMangasUnreadType',
type: IsarType.long,
),
r'libraryLocalSource': PropertySchema(
id: 49,
id: 50,
name: r'libraryLocalSource',
type: IsarType.bool,
),
r'libraryShowCategoryTabs': PropertySchema(
id: 50,
id: 51,
name: r'libraryShowCategoryTabs',
type: IsarType.bool,
),
r'libraryShowContinueReadingButton': PropertySchema(
id: 51,
id: 52,
name: r'libraryShowContinueReadingButton',
type: IsarType.bool,
),
r'libraryShowLanguage': PropertySchema(
id: 52,
id: 53,
name: r'libraryShowLanguage',
type: IsarType.bool,
),
r'libraryShowNumbersOfItems': PropertySchema(
id: 53,
id: 54,
name: r'libraryShowNumbersOfItems',
type: IsarType.bool,
),
r'locale': PropertySchema(
id: 54,
id: 55,
name: r'locale',
type: IsarType.object,
target: r'L10nLocale',
),
r'markEpisodeAsSeenType': PropertySchema(
id: 55,
id: 56,
name: r'markEpisodeAsSeenType',
type: IsarType.long,
),
r'onlyIncludePinnedSources': PropertySchema(
id: 56,
id: 57,
name: r'onlyIncludePinnedSources',
type: IsarType.bool,
),
r'pagePreloadAmount': PropertySchema(
id: 57,
id: 58,
name: r'pagePreloadAmount',
type: IsarType.long,
),
r'personalPageModeList': PropertySchema(
id: 58,
id: 59,
name: r'personalPageModeList',
type: IsarType.objectList,
target: r'PersonalPageMode',
),
r'personalReaderModeList': PropertySchema(
id: 59,
id: 60,
name: r'personalReaderModeList',
type: IsarType.objectList,
target: r'PersonalReaderMode',
),
r'pureBlackDarkMode': PropertySchema(
id: 60,
id: 61,
name: r'pureBlackDarkMode',
type: IsarType.bool,
),
r'relativeTimesTamps': PropertySchema(
id: 61,
id: 62,
name: r'relativeTimesTamps',
type: IsarType.long,
),
r'saveAsCBZArchive': PropertySchema(
id: 62,
id: 63,
name: r'saveAsCBZArchive',
type: IsarType.bool,
),
r'scaleType': PropertySchema(
id: 63,
id: 64,
name: r'scaleType',
type: IsarType.byte,
enumMap: _SettingsscaleTypeEnumValueMap,
),
r'showNSFW': PropertySchema(
id: 64,
id: 65,
name: r'showNSFW',
type: IsarType.bool,
),
r'showPagesNumber': PropertySchema(
id: 65,
id: 66,
name: r'showPagesNumber',
type: IsarType.bool,
),
r'sortChapterList': PropertySchema(
id: 66,
id: 67,
name: r'sortChapterList',
type: IsarType.objectList,
target: r'SortChapter',
),
r'sortLibraryAnime': PropertySchema(
id: 67,
id: 68,
name: r'sortLibraryAnime',
type: IsarType.object,
target: r'SortLibraryManga',
),
r'sortLibraryManga': PropertySchema(
id: 68,
id: 69,
name: r'sortLibraryManga',
type: IsarType.object,
target: r'SortLibraryManga',
),
r'startDatebackup': PropertySchema(
id: 69,
id: 70,
name: r'startDatebackup',
type: IsarType.long,
),
r'themeIsDark': PropertySchema(
id: 70,
id: 71,
name: r'themeIsDark',
type: IsarType.bool,
),
r'updateProgressAfterReading': PropertySchema(
id: 71,
id: 72,
name: r'updateProgressAfterReading',
type: IsarType.bool,
),
r'usePageTapZones': PropertySchema(
id: 72,
id: 73,
name: r'usePageTapZones',
type: IsarType.bool,
),
r'userAgent': PropertySchema(
id: 73,
id: 74,
name: r'userAgent',
type: IsarType.string,
)
@ -749,71 +754,72 @@ void _settingsSerialize(
);
writer.writeDouble(offsets[37], object.flexColorSchemeBlendLevel);
writer.writeLong(offsets[38], object.flexSchemeColorIndex);
writer.writeBool(offsets[39], object.incognitoMode);
writer.writeBool(offsets[40], object.libraryDownloadedChapters);
writer.writeLong(offsets[41], object.libraryFilterAnimeBookMarkedType);
writer.writeLong(offsets[42], object.libraryFilterAnimeDownloadType);
writer.writeLong(offsets[43], object.libraryFilterAnimeStartedType);
writer.writeLong(offsets[44], object.libraryFilterAnimeUnreadType);
writer.writeLong(offsets[45], object.libraryFilterMangasBookMarkedType);
writer.writeLong(offsets[46], object.libraryFilterMangasDownloadType);
writer.writeLong(offsets[47], object.libraryFilterMangasStartedType);
writer.writeLong(offsets[48], object.libraryFilterMangasUnreadType);
writer.writeBool(offsets[49], object.libraryLocalSource);
writer.writeBool(offsets[50], object.libraryShowCategoryTabs);
writer.writeBool(offsets[51], object.libraryShowContinueReadingButton);
writer.writeBool(offsets[52], object.libraryShowLanguage);
writer.writeBool(offsets[53], object.libraryShowNumbersOfItems);
writer.writeBool(offsets[39], object.fullScreenReader);
writer.writeBool(offsets[40], object.incognitoMode);
writer.writeBool(offsets[41], object.libraryDownloadedChapters);
writer.writeLong(offsets[42], object.libraryFilterAnimeBookMarkedType);
writer.writeLong(offsets[43], object.libraryFilterAnimeDownloadType);
writer.writeLong(offsets[44], object.libraryFilterAnimeStartedType);
writer.writeLong(offsets[45], object.libraryFilterAnimeUnreadType);
writer.writeLong(offsets[46], object.libraryFilterMangasBookMarkedType);
writer.writeLong(offsets[47], object.libraryFilterMangasDownloadType);
writer.writeLong(offsets[48], object.libraryFilterMangasStartedType);
writer.writeLong(offsets[49], object.libraryFilterMangasUnreadType);
writer.writeBool(offsets[50], object.libraryLocalSource);
writer.writeBool(offsets[51], object.libraryShowCategoryTabs);
writer.writeBool(offsets[52], object.libraryShowContinueReadingButton);
writer.writeBool(offsets[53], object.libraryShowLanguage);
writer.writeBool(offsets[54], object.libraryShowNumbersOfItems);
writer.writeObject<L10nLocale>(
offsets[54],
offsets[55],
allOffsets,
L10nLocaleSchema.serialize,
object.locale,
);
writer.writeLong(offsets[55], object.markEpisodeAsSeenType);
writer.writeBool(offsets[56], object.onlyIncludePinnedSources);
writer.writeLong(offsets[57], object.pagePreloadAmount);
writer.writeLong(offsets[56], object.markEpisodeAsSeenType);
writer.writeBool(offsets[57], object.onlyIncludePinnedSources);
writer.writeLong(offsets[58], object.pagePreloadAmount);
writer.writeObjectList<PersonalPageMode>(
offsets[58],
offsets[59],
allOffsets,
PersonalPageModeSchema.serialize,
object.personalPageModeList,
);
writer.writeObjectList<PersonalReaderMode>(
offsets[59],
offsets[60],
allOffsets,
PersonalReaderModeSchema.serialize,
object.personalReaderModeList,
);
writer.writeBool(offsets[60], object.pureBlackDarkMode);
writer.writeLong(offsets[61], object.relativeTimesTamps);
writer.writeBool(offsets[62], object.saveAsCBZArchive);
writer.writeByte(offsets[63], object.scaleType.index);
writer.writeBool(offsets[64], object.showNSFW);
writer.writeBool(offsets[65], object.showPagesNumber);
writer.writeBool(offsets[61], object.pureBlackDarkMode);
writer.writeLong(offsets[62], object.relativeTimesTamps);
writer.writeBool(offsets[63], object.saveAsCBZArchive);
writer.writeByte(offsets[64], object.scaleType.index);
writer.writeBool(offsets[65], object.showNSFW);
writer.writeBool(offsets[66], object.showPagesNumber);
writer.writeObjectList<SortChapter>(
offsets[66],
offsets[67],
allOffsets,
SortChapterSchema.serialize,
object.sortChapterList,
);
writer.writeObject<SortLibraryManga>(
offsets[67],
offsets[68],
allOffsets,
SortLibraryMangaSchema.serialize,
object.sortLibraryAnime,
);
writer.writeObject<SortLibraryManga>(
offsets[68],
offsets[69],
allOffsets,
SortLibraryMangaSchema.serialize,
object.sortLibraryManga,
);
writer.writeLong(offsets[69], object.startDatebackup);
writer.writeBool(offsets[70], object.themeIsDark);
writer.writeBool(offsets[71], object.updateProgressAfterReading);
writer.writeBool(offsets[72], object.usePageTapZones);
writer.writeString(offsets[73], object.userAgent);
writer.writeLong(offsets[70], object.startDatebackup);
writer.writeBool(offsets[71], object.themeIsDark);
writer.writeBool(offsets[72], object.updateProgressAfterReading);
writer.writeBool(offsets[73], object.usePageTapZones);
writer.writeString(offsets[74], object.userAgent);
}
Settings _settingsDeserialize(
@ -892,66 +898,67 @@ Settings _settingsDeserialize(
enableAutoSkip: reader.readBoolOrNull(offsets[35]),
flexColorSchemeBlendLevel: reader.readDoubleOrNull(offsets[37]),
flexSchemeColorIndex: reader.readLongOrNull(offsets[38]),
fullScreenReader: reader.readBoolOrNull(offsets[39]),
id: id,
incognitoMode: reader.readBoolOrNull(offsets[39]),
libraryDownloadedChapters: reader.readBoolOrNull(offsets[40]),
libraryFilterAnimeBookMarkedType: reader.readLongOrNull(offsets[41]),
libraryFilterAnimeDownloadType: reader.readLongOrNull(offsets[42]),
libraryFilterAnimeStartedType: reader.readLongOrNull(offsets[43]),
libraryFilterAnimeUnreadType: reader.readLongOrNull(offsets[44]),
libraryFilterMangasBookMarkedType: reader.readLongOrNull(offsets[45]),
libraryFilterMangasDownloadType: reader.readLongOrNull(offsets[46]),
libraryFilterMangasStartedType: reader.readLongOrNull(offsets[47]),
libraryFilterMangasUnreadType: reader.readLongOrNull(offsets[48]),
libraryLocalSource: reader.readBoolOrNull(offsets[49]),
libraryShowCategoryTabs: reader.readBoolOrNull(offsets[50]),
libraryShowContinueReadingButton: reader.readBoolOrNull(offsets[51]),
libraryShowLanguage: reader.readBoolOrNull(offsets[52]),
libraryShowNumbersOfItems: reader.readBoolOrNull(offsets[53]),
markEpisodeAsSeenType: reader.readLongOrNull(offsets[55]),
onlyIncludePinnedSources: reader.readBoolOrNull(offsets[56]),
pagePreloadAmount: reader.readLongOrNull(offsets[57]),
incognitoMode: reader.readBoolOrNull(offsets[40]),
libraryDownloadedChapters: reader.readBoolOrNull(offsets[41]),
libraryFilterAnimeBookMarkedType: reader.readLongOrNull(offsets[42]),
libraryFilterAnimeDownloadType: reader.readLongOrNull(offsets[43]),
libraryFilterAnimeStartedType: reader.readLongOrNull(offsets[44]),
libraryFilterAnimeUnreadType: reader.readLongOrNull(offsets[45]),
libraryFilterMangasBookMarkedType: reader.readLongOrNull(offsets[46]),
libraryFilterMangasDownloadType: reader.readLongOrNull(offsets[47]),
libraryFilterMangasStartedType: reader.readLongOrNull(offsets[48]),
libraryFilterMangasUnreadType: reader.readLongOrNull(offsets[49]),
libraryLocalSource: reader.readBoolOrNull(offsets[50]),
libraryShowCategoryTabs: reader.readBoolOrNull(offsets[51]),
libraryShowContinueReadingButton: reader.readBoolOrNull(offsets[52]),
libraryShowLanguage: reader.readBoolOrNull(offsets[53]),
libraryShowNumbersOfItems: reader.readBoolOrNull(offsets[54]),
markEpisodeAsSeenType: reader.readLongOrNull(offsets[56]),
onlyIncludePinnedSources: reader.readBoolOrNull(offsets[57]),
pagePreloadAmount: reader.readLongOrNull(offsets[58]),
personalPageModeList: reader.readObjectList<PersonalPageMode>(
offsets[58],
offsets[59],
PersonalPageModeSchema.deserialize,
allOffsets,
PersonalPageMode(),
),
personalReaderModeList: reader.readObjectList<PersonalReaderMode>(
offsets[59],
offsets[60],
PersonalReaderModeSchema.deserialize,
allOffsets,
PersonalReaderMode(),
),
pureBlackDarkMode: reader.readBoolOrNull(offsets[60]),
relativeTimesTamps: reader.readLongOrNull(offsets[61]),
saveAsCBZArchive: reader.readBoolOrNull(offsets[62]),
pureBlackDarkMode: reader.readBoolOrNull(offsets[61]),
relativeTimesTamps: reader.readLongOrNull(offsets[62]),
saveAsCBZArchive: reader.readBoolOrNull(offsets[63]),
scaleType:
_SettingsscaleTypeValueEnumMap[reader.readByteOrNull(offsets[63])] ??
_SettingsscaleTypeValueEnumMap[reader.readByteOrNull(offsets[64])] ??
ScaleType.fitScreen,
showNSFW: reader.readBoolOrNull(offsets[64]),
showPagesNumber: reader.readBoolOrNull(offsets[65]),
showNSFW: reader.readBoolOrNull(offsets[65]),
showPagesNumber: reader.readBoolOrNull(offsets[66]),
sortChapterList: reader.readObjectList<SortChapter>(
offsets[66],
offsets[67],
SortChapterSchema.deserialize,
allOffsets,
SortChapter(),
),
sortLibraryAnime: reader.readObjectOrNull<SortLibraryManga>(
offsets[67],
SortLibraryMangaSchema.deserialize,
allOffsets,
),
sortLibraryManga: reader.readObjectOrNull<SortLibraryManga>(
offsets[68],
SortLibraryMangaSchema.deserialize,
allOffsets,
),
startDatebackup: reader.readLongOrNull(offsets[69]),
themeIsDark: reader.readBoolOrNull(offsets[70]),
updateProgressAfterReading: reader.readBoolOrNull(offsets[71]),
usePageTapZones: reader.readBoolOrNull(offsets[72]),
userAgent: reader.readStringOrNull(offsets[73]),
sortLibraryManga: reader.readObjectOrNull<SortLibraryManga>(
offsets[69],
SortLibraryMangaSchema.deserialize,
allOffsets,
),
startDatebackup: reader.readLongOrNull(offsets[70]),
themeIsDark: reader.readBoolOrNull(offsets[71]),
updateProgressAfterReading: reader.readBoolOrNull(offsets[72]),
usePageTapZones: reader.readBoolOrNull(offsets[73]),
userAgent: reader.readStringOrNull(offsets[74]),
);
object.chapterFilterBookmarkedList =
reader.readObjectList<ChapterFilterBookmarked>(
@ -973,7 +980,7 @@ Settings _settingsDeserialize(
FilterScanlator(),
);
object.locale = reader.readObjectOrNull<L10nLocale>(
offsets[54],
offsets[55],
L10nLocaleSchema.deserialize,
allOffsets,
);
@ -1117,7 +1124,7 @@ P _settingsDeserializeProp<P>(
case 40:
return (reader.readBoolOrNull(offset)) as P;
case 41:
return (reader.readLongOrNull(offset)) as P;
return (reader.readBoolOrNull(offset)) as P;
case 42:
return (reader.readLongOrNull(offset)) as P;
case 43:
@ -1133,7 +1140,7 @@ P _settingsDeserializeProp<P>(
case 48:
return (reader.readLongOrNull(offset)) as P;
case 49:
return (reader.readBoolOrNull(offset)) as P;
return (reader.readLongOrNull(offset)) as P;
case 50:
return (reader.readBoolOrNull(offset)) as P;
case 51:
@ -1143,57 +1150,53 @@ P _settingsDeserializeProp<P>(
case 53:
return (reader.readBoolOrNull(offset)) as P;
case 54:
return (reader.readBoolOrNull(offset)) as P;
case 55:
return (reader.readObjectOrNull<L10nLocale>(
offset,
L10nLocaleSchema.deserialize,
allOffsets,
)) as P;
case 55:
return (reader.readLongOrNull(offset)) as P;
case 56:
return (reader.readBoolOrNull(offset)) as P;
case 57:
return (reader.readLongOrNull(offset)) as P;
case 57:
return (reader.readBoolOrNull(offset)) as P;
case 58:
return (reader.readLongOrNull(offset)) as P;
case 59:
return (reader.readObjectList<PersonalPageMode>(
offset,
PersonalPageModeSchema.deserialize,
allOffsets,
PersonalPageMode(),
)) as P;
case 59:
case 60:
return (reader.readObjectList<PersonalReaderMode>(
offset,
PersonalReaderModeSchema.deserialize,
allOffsets,
PersonalReaderMode(),
)) as P;
case 60:
return (reader.readBoolOrNull(offset)) as P;
case 61:
return (reader.readLongOrNull(offset)) as P;
case 62:
return (reader.readBoolOrNull(offset)) as P;
case 62:
return (reader.readLongOrNull(offset)) as P;
case 63:
return (reader.readBoolOrNull(offset)) as P;
case 64:
return (_SettingsscaleTypeValueEnumMap[reader.readByteOrNull(offset)] ??
ScaleType.fitScreen) as P;
case 64:
return (reader.readBoolOrNull(offset)) as P;
case 65:
return (reader.readBoolOrNull(offset)) as P;
case 66:
return (reader.readBoolOrNull(offset)) as P;
case 67:
return (reader.readObjectList<SortChapter>(
offset,
SortChapterSchema.deserialize,
allOffsets,
SortChapter(),
)) as P;
case 67:
return (reader.readObjectOrNull<SortLibraryManga>(
offset,
SortLibraryMangaSchema.deserialize,
allOffsets,
)) as P;
case 68:
return (reader.readObjectOrNull<SortLibraryManga>(
offset,
@ -1201,14 +1204,20 @@ P _settingsDeserializeProp<P>(
allOffsets,
)) as P;
case 69:
return (reader.readLongOrNull(offset)) as P;
return (reader.readObjectOrNull<SortLibraryManga>(
offset,
SortLibraryMangaSchema.deserialize,
allOffsets,
)) as P;
case 70:
return (reader.readBoolOrNull(offset)) as P;
return (reader.readLongOrNull(offset)) as P;
case 71:
return (reader.readBoolOrNull(offset)) as P;
case 72:
return (reader.readBoolOrNull(offset)) as P;
case 73:
return (reader.readBoolOrNull(offset)) as P;
case 74:
return (reader.readStringOrNull(offset)) as P;
default:
throw IsarError('Unknown property with id $propertyId');
@ -4267,6 +4276,34 @@ extension SettingsQueryFilter
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition>
fullScreenReaderIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNull(
property: r'fullScreenReader',
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition>
fullScreenReaderIsNotNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNotNull(
property: r'fullScreenReader',
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition>
fullScreenReaderEqualTo(bool? value) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.equalTo(
property: r'fullScreenReader',
value: value,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition> idIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNull(
@ -6770,6 +6807,18 @@ extension SettingsQuerySortBy on QueryBuilder<Settings, Settings, QSortBy> {
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> sortByFullScreenReader() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'fullScreenReader', Sort.asc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> sortByFullScreenReaderDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'fullScreenReader', Sort.desc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> sortByIncognitoMode() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'incognitoMode', Sort.asc);
@ -7545,6 +7594,18 @@ extension SettingsQuerySortThenBy
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> thenByFullScreenReader() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'fullScreenReader', Sort.asc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> thenByFullScreenReaderDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'fullScreenReader', Sort.desc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> thenById() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'id', Sort.asc);
@ -8147,6 +8208,12 @@ extension SettingsQueryWhereDistinct
});
}
QueryBuilder<Settings, Settings, QDistinct> distinctByFullScreenReader() {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(r'fullScreenReader');
});
}
QueryBuilder<Settings, Settings, QDistinct> distinctByIncognitoMode() {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(r'incognitoMode');
@ -8609,6 +8676,12 @@ extension SettingsQueryProperty
});
}
QueryBuilder<Settings, bool?, QQueryOperations> fullScreenReaderProperty() {
return QueryBuilder.apply(this, (query) {
return query.addPropertyName(r'fullScreenReader');
});
}
QueryBuilder<Settings, bool?, QQueryOperations> incognitoModeProperty() {
return QueryBuilder.apply(this, (query) {
return query.addPropertyName(r'incognitoMode');

View file

@ -38,6 +38,8 @@ class _AnimePlayerViewState extends riv.ConsumerState<AnimePlayerView> {
@override
void dispose() {
MTorrentServer().removeTorrent(_infoHash);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
super.dispose();
}
@ -58,22 +60,12 @@ class _AnimePlayerViewState extends riv.ConsumerState<AnimePlayerView> {
title: const Text(''),
leading: BackButton(
onPressed: () {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
},
),
),
body: WillPopScope(
onWillPop: () async {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
return false;
},
child: const Center(
child: Text("Error"),
),
body: const Center(
child: Text("Error"),
),
);
}
@ -96,17 +88,8 @@ class _AnimePlayerViewState extends riv.ConsumerState<AnimePlayerView> {
},
),
),
body: WillPopScope(
onWillPop: () async {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
return false;
},
child: Center(
child: Text(error.toString()),
),
body: Center(
child: Text(error.toString()),
),
),
loading: () {
@ -124,16 +107,7 @@ class _AnimePlayerViewState extends riv.ConsumerState<AnimePlayerView> {
},
),
),
body: WillPopScope(
onWillPop: () async {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
return false;
},
child: const ProgressCenter(),
),
body: const ProgressCenter(),
);
},
);
@ -1192,15 +1166,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: WillPopScope(
onWillPop: () async {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
return false;
},
child: _videoPlayer(context),
),
body: _videoPlayer(context),
);
}
}

View file

@ -70,45 +70,39 @@ class _MangaReaderDetailState extends ConsumerState<MangaReaderDetail> {
.future);
}
},
child: WillPopScope(
onWillPop: () async {
Navigator.pop(context);
return false;
},
child: Stack(
children: [
MangaDetailsView(
manga: manga,
sourceExist: sourceExist,
checkForUpdate: (value) async {
if (!_isLoading) {
setState(() {
_isLoading = true;
});
if (sourceExist) {
await ref.read(updateMangaDetailProvider(
mangaId: manga.id, isInit: false)
.future);
}
if (mounted) {
setState(() {
_isLoading = false;
});
}
child: Stack(
children: [
MangaDetailsView(
manga: manga,
sourceExist: sourceExist,
checkForUpdate: (value) async {
if (!_isLoading) {
setState(() {
_isLoading = true;
});
if (sourceExist) {
await ref.read(updateMangaDetailProvider(
mangaId: manga.id, isInit: false)
.future);
}
},
),
if (_isLoading)
const Positioned(
top: 0,
bottom: 0,
left: 0,
right: 0,
child: Center(
child: CircularProgressIndicator(),
)),
],
),
if (mounted) {
setState(() {
_isLoading = false;
});
}
}
},
),
if (_isLoading)
const Positioned(
top: 0,
bottom: 0,
left: 0,
right: 0,
child: Center(
child: CircularProgressIndicator(),
)),
],
),
);
});

View file

@ -312,205 +312,199 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
),
),
),
body: WillPopScope(
onWillPop: () async {
Navigator.pop(context);
return false;
},
child: _getManga!.when(
data: (data) {
if (_mangaList.isEmpty && data!.list.isNotEmpty) {
_mangaList.addAll(data.list);
}
if (_getManga!.isLoading) {
return const ProgressCenter();
}
Widget buildProgressIndicator() {
return !(data!.list.isNotEmpty && (_hasNextPage))
? Container()
: _isLoading
? const Center(
child: SizedBox(
height: 100,
width: 200,
child: Center(
child: CircularProgressIndicator(),
),
),
)
: context.isTablet
? Padding(
padding: const EdgeInsets.all(4),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(5))),
onPressed: () {
if (!_getManga!.isLoading) {
if (mounted) {
setState(() {
_isLoading = true;
});
}
_loadMore().then((value) {
if (mounted && value != null) {
setState(() {
_mangaList.addAll(value.list);
_isLoading = false;
});
}
});
}
},
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(l10n.load_more),
const SizedBox(
height: 10,
),
const Icon(
Icons.arrow_forward_outlined),
],
)),
)
: Container();
}
if (data!.list.isEmpty) {
return Center(child: Text(l10n.no_result));
}
_scrollController.addListener(() {
if (_scrollController.position.pixels ==
_scrollController.position.maxScrollExtent) {
if (_mangaList.isNotEmpty &&
(_hasNextPage) &&
!_isLoading &&
!_getManga!.isLoading) {
if (mounted) {
setState(() {
_isLoading = true;
});
}
_loadMore().then((value) {
if (mounted && value != null) {
setState(() {
_mangaList.addAll(value.list);
_isLoading = false;
});
}
});
}
}
});
_length = widget.source.isFullData!
? _fullDataLength
: _mangaList.length;
_length =
(_mangaList.length < _length ? _mangaList.length : _length);
return Padding(
padding: const EdgeInsets.only(top: 10),
child: Column(
children: [
Flexible(
child: GridViewWidget(
controller: _scrollController,
itemCount: _length + 1,
itemBuilder: (context, index) {
if (index == _length) {
return buildProgressIndicator();
}
return MangaHomeImageCard(
isManga: widget.source.isManga ?? true,
manga: _mangaList[index],
source: widget.source,
);
},
)),
],
),
);
},
error: (error, stackTrace) => Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(15),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
IconButton(
onPressed: () {
if (_selectedIndex == 2 &&
(_isSearch && _query.isNotEmpty) ||
_isFiltering) {
ref.invalidate(searchProvider(
source: widget.source,
query: _query,
page: 1,
filterList: filters));
} else if (_selectedIndex == 1 &&
!_isSearch &&
_query.isEmpty) {
ref.invalidate(getLatestUpdatesProvider(
source: widget.source, page: 1));
} else if (_selectedIndex == 0 &&
!_isSearch &&
_query.isEmpty) {
ref.invalidate(getPopularProvider(
source: widget.source,
page: 1,
));
}
},
icon: const Icon(Icons.refresh)),
Text(l10n.refresh)
],
),
const SizedBox(
width: 20,
),
Column(
children: [
IconButton(
onPressed: () {
Map<String, String> data = {
'url': widget.source.baseUrl!,
'sourceId': widget.source.id.toString(),
'title': ''
};
context.push("/mangawebview", extra: data);
},
icon: Icon(
Icons.public,
size: 22,
color: context.secondaryColor,
body: _getManga!.when(
data: (data) {
if (_mangaList.isEmpty && data!.list.isNotEmpty) {
_mangaList.addAll(data.list);
}
if (_getManga!.isLoading) {
return const ProgressCenter();
}
Widget buildProgressIndicator() {
return !(data!.list.isNotEmpty && (_hasNextPage))
? Container()
: _isLoading
? const Center(
child: SizedBox(
height: 100,
width: 200,
child: Center(
child: CircularProgressIndicator(),
),
),
const Text("Webview")
],
)
],
),
)
: context.isTablet
? Padding(
padding: const EdgeInsets.all(4),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(5))),
onPressed: () {
if (!_getManga!.isLoading) {
if (mounted) {
setState(() {
_isLoading = true;
});
}
_loadMore().then((value) {
if (mounted && value != null) {
setState(() {
_mangaList.addAll(value.list);
_isLoading = false;
});
}
});
}
},
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(l10n.load_more),
const SizedBox(
height: 10,
),
const Icon(
Icons.arrow_forward_outlined),
],
)),
)
: Container();
}
if (data!.list.isEmpty) {
return Center(child: Text(l10n.no_result));
}
_scrollController.addListener(() {
if (_scrollController.position.pixels ==
_scrollController.position.maxScrollExtent) {
if (_mangaList.isNotEmpty &&
(_hasNextPage) &&
!_isLoading &&
!_getManga!.isLoading) {
if (mounted) {
setState(() {
_isLoading = true;
});
}
_loadMore().then((value) {
if (mounted && value != null) {
setState(() {
_mangaList.addAll(value.list);
_isLoading = false;
});
}
});
}
}
});
_length = widget.source.isFullData!
? _fullDataLength
: _mangaList.length;
_length =
(_mangaList.length < _length ? _mangaList.length : _length);
return Padding(
padding: const EdgeInsets.only(top: 10),
child: Column(
children: [
Flexible(
child: GridViewWidget(
controller: _scrollController,
itemCount: _length + 1,
itemBuilder: (context, index) {
if (index == _length) {
return buildProgressIndicator();
}
return MangaHomeImageCard(
isManga: widget.source.isManga ?? true,
manga: _mangaList[index],
source: widget.source,
);
},
)),
],
),
);
},
error: (error, stackTrace) => Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(15),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
IconButton(
onPressed: () {
if (_selectedIndex == 2 &&
(_isSearch && _query.isNotEmpty) ||
_isFiltering) {
ref.invalidate(searchProvider(
source: widget.source,
query: _query,
page: 1,
filterList: filters));
} else if (_selectedIndex == 1 &&
!_isSearch &&
_query.isEmpty) {
ref.invalidate(getLatestUpdatesProvider(
source: widget.source, page: 1));
} else if (_selectedIndex == 0 &&
!_isSearch &&
_query.isEmpty) {
ref.invalidate(getPopularProvider(
source: widget.source,
page: 1,
));
}
},
icon: const Icon(Icons.refresh)),
Text(l10n.refresh)
],
),
const SizedBox(
width: 20,
),
Column(
children: [
IconButton(
onPressed: () {
Map<String, String> data = {
'url': widget.source.baseUrl!,
'sourceId': widget.source.id.toString(),
'title': ''
};
context.push("/mangawebview", extra: data);
},
icon: Icon(
Icons.public,
size: 22,
color: context.secondaryColor,
),
),
const Text("Webview")
],
)
],
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
error.toString(),
textAlign: TextAlign.center,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
error.toString(),
textAlign: TextAlign.center,
),
],
),
loading: () => const Center(
child: CircularProgressIndicator(),
),
),
],
),
loading: () => const Center(
child: CircularProgressIndicator(),
),
));
}

View file

@ -12,6 +12,7 @@ import 'package:go_router/go_router.dart';
import 'package:mangayomi/main.dart';
import 'package:mangayomi/models/chapter.dart';
import 'package:mangayomi/models/settings.dart';
import 'package:mangayomi/modules/anime/widgets/desktop.dart';
import 'package:mangayomi/modules/manga/reader/double_columm_view_vertical.dart';
import 'package:mangayomi/modules/manga/reader/double_columm_view_center.dart';
import 'package:mangayomi/modules/manga/reader/providers/crop_borders_provider.dart';
@ -32,6 +33,7 @@ import 'package:mangayomi/utils/reg_exp_matcher.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:window_manager/window_manager.dart';
typedef DoubleClickAnimationListener = void Function();
@ -44,7 +46,6 @@ class MangaReaderView extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
final chapterData = ref.watch(getChapterPagesProvider(
chapter: chapter,
));
@ -65,16 +66,8 @@ class MangaReaderView extends ConsumerWidget {
},
),
),
body: WillPopScope(
onWillPop: () async {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
return false;
},
child: const Center(
child: Text("Error"),
),
body: const Center(
child: Text("Error"),
),
);
}
@ -86,22 +79,12 @@ class MangaReaderView extends ConsumerWidget {
title: const Text(''),
leading: BackButton(
onPressed: () {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
},
),
),
body: WillPopScope(
onWillPop: () async {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
return false;
},
child: Center(
child: Text(error.toString()),
),
body: Center(
child: Text(error.toString()),
),
),
loading: () {
@ -111,21 +94,11 @@ class MangaReaderView extends ConsumerWidget {
title: const Text(''),
leading: BackButton(
onPressed: () {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
},
),
),
body: WillPopScope(
onWillPop: () async {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
Navigator.pop(context);
return false;
},
child: const ProgressCenter(),
),
body: const ProgressCenter(),
);
},
);
@ -155,6 +128,7 @@ class _MangaChapterPageGalleryState
late Animation<double> _animation;
late ReaderController _readerController =
ref.read(readerControllerProvider(chapter: chapter).notifier);
bool isDesktop = Platform.isMacOS || Platform.isLinux || Platform.isWindows;
@override
void dispose() {
@ -165,6 +139,12 @@ class _MangaChapterPageGalleryState
_doubleClickAnimationController.dispose();
_autoScroll.value = false;
clearGestureDetailsCache();
if (isDesktop) {
setFullScreen(value: false);
} else {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
}
super.dispose();
}
@ -252,100 +232,106 @@ class _MangaChapterPageGalleryState
final List<int> _cropBorderCheckList = [];
void _setFullScreen({bool? value}) async {
if (isDesktop) {
value = await windowManager.isFullScreen();
setFullScreen(value: !value);
}
ref.read(fullScreenReaderStateProvider.notifier).set(!value!);
}
@override
Widget build(BuildContext context) {
final backgroundColor = ref.watch(backgroundColorStateProvider);
final fullScreenReader = ref.watch(fullScreenReaderStateProvider);
final cropBorders = ref.watch(cropBordersStateProvider);
if (cropBorders) {
_processCropBorders();
}
final usePageTapZones = ref.watch(usePageTapZonesStateProvider);
final l10n = l10nLocalizations(context)!;
return WillPopScope(
onWillPop: () async {
_goBack(context);
return false;
return RawKeyboardListener(
autofocus: true,
focusNode: FocusNode(),
onKey: (event) {
bool hasNextChapter = _readerController.getChapterIndex().$1 != 0;
bool hasPrevChapter = _readerController.getChapterIndex().$1 + 1 !=
_readerController
.getChaptersLength(_readerController.getChapterIndex().$2);
final action = switch (event.logicalKey) {
LogicalKeyboardKey.f11 =>
(!event.isKeyPressed(LogicalKeyboardKey.f11) || event.repeat)
? _setFullScreen()
: null,
LogicalKeyboardKey.escape =>
(!event.isKeyPressed(LogicalKeyboardKey.escape) || event.repeat)
? _goBack(context)
: null,
LogicalKeyboardKey.backspace =>
(!event.isKeyPressed(LogicalKeyboardKey.backspace) || event.repeat)
? _goBack(context)
: null,
LogicalKeyboardKey.arrowUp =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowUp) || event.repeat)
? _onBtnTapped(_currentIndex! - 1, true)
: null,
LogicalKeyboardKey.arrowLeft =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowLeft) || event.repeat)
? _isReverseHorizontal
? _onBtnTapped(_currentIndex! + 1, false)
: _onBtnTapped(_currentIndex! - 1, true)
: null,
LogicalKeyboardKey.arrowRight =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowRight) || event.repeat)
? _isReverseHorizontal
? _onBtnTapped(_currentIndex! - 1, true)
: _onBtnTapped(_currentIndex! + 1, false)
: null,
LogicalKeyboardKey.arrowDown =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowDown) || event.repeat)
? _onBtnTapped(_currentIndex! + 1, true)
: null,
LogicalKeyboardKey.keyN ||
LogicalKeyboardKey.pageDown =>
((!event.isKeyPressed(LogicalKeyboardKey.keyN) ||
!event.isKeyPressed(LogicalKeyboardKey.pageDown)) ||
event.repeat)
? switch (hasNextChapter) {
true => pushReplacementMangaReaderView(
context: context,
chapter: _readerController.getNextChapter(),
),
_ => null
}
: null,
LogicalKeyboardKey.keyP ||
LogicalKeyboardKey.pageUp =>
((!event.isKeyPressed(LogicalKeyboardKey.keyP) ||
!event.isKeyPressed(LogicalKeyboardKey.pageUp)) ||
event.repeat)
? switch (hasPrevChapter) {
true => pushReplacementMangaReaderView(
context: context,
chapter: _readerController.getPrevChapter()),
_ => null
}
: null,
_ => null
};
action;
},
child: RawKeyboardListener(
autofocus: true,
focusNode: FocusNode(),
onKey: (event) {
bool hasNextChapter = _readerController.getChapterIndex().$1 != 0;
bool hasPrevChapter = _readerController.getChapterIndex().$1 + 1 !=
_readerController
.getChaptersLength(_readerController.getChapterIndex().$2);
final action = switch (event.logicalKey) {
LogicalKeyboardKey.escape =>
(!event.isKeyPressed(LogicalKeyboardKey.escape) || event.repeat)
? _goBack(context)
: null,
LogicalKeyboardKey.backspace =>
(!event.isKeyPressed(LogicalKeyboardKey.backspace) ||
event.repeat)
? _goBack(context)
: null,
LogicalKeyboardKey.arrowUp =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowUp) || event.repeat)
? _onBtnTapped(_currentIndex! - 1, true)
: null,
LogicalKeyboardKey.arrowLeft =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowLeft) ||
event.repeat)
? _isReverseHorizontal
? _onBtnTapped(_currentIndex! + 1, false)
: _onBtnTapped(_currentIndex! - 1, true)
: null,
LogicalKeyboardKey.arrowRight =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowRight) ||
event.repeat)
? _isReverseHorizontal
? _onBtnTapped(_currentIndex! - 1, true)
: _onBtnTapped(_currentIndex! + 1, false)
: null,
LogicalKeyboardKey.arrowDown =>
(!event.isKeyPressed(LogicalKeyboardKey.arrowDown) ||
event.repeat)
? _onBtnTapped(_currentIndex! + 1, true)
: null,
LogicalKeyboardKey.keyN ||
LogicalKeyboardKey.pageDown =>
((!event.isKeyPressed(LogicalKeyboardKey.keyN) ||
!event.isKeyPressed(LogicalKeyboardKey.pageDown)) ||
event.repeat)
? switch (hasNextChapter) {
true => pushReplacementMangaReaderView(
context: context,
chapter: _readerController.getNextChapter(),
),
_ => null
}
: null,
LogicalKeyboardKey.keyP ||
LogicalKeyboardKey.pageUp =>
((!event.isKeyPressed(LogicalKeyboardKey.keyP) ||
!event.isKeyPressed(LogicalKeyboardKey.pageUp)) ||
event.repeat)
? switch (hasPrevChapter) {
true => pushReplacementMangaReaderView(
context: context,
chapter: _readerController.getPrevChapter()),
_ => null
}
: null,
_ => null
};
action;
},
child: NotificationListener<UserScrollNotification>(
onNotification: (notification) {
if (notification.direction == ScrollDirection.idle) {
if (_isView) {
_isViewFunction();
}
child: NotificationListener<UserScrollNotification>(
onNotification: (notification) {
if (notification.direction == ScrollDirection.idle) {
if (_isView) {
_isViewFunction();
}
}
return true;
},
return true;
},
child: SafeArea(
top: !fullScreenReader,
child: ValueListenableBuilder(
valueListenable: _failedToLoadImage,
builder: (context, failedToLoadImage, child) {
@ -843,6 +829,14 @@ class _MangaChapterPageGalleryState
_uChapDataPreload.addAll(_chapterUrlModel.uChapDataPreload);
_readerController.setMangaHistoryUpdate();
await Future.delayed(const Duration(milliseconds: 1));
final fullScreenReader = ref.watch(fullScreenReaderStateProvider);
if (fullScreenReader) {
if (isDesktop) {
setFullScreen(value: true);
} else {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
}
}
ref.read(_currentReaderMode.notifier).state = readerMode;
if (mounted) {
setState(() {
@ -1145,23 +1139,23 @@ class _MangaChapterPageGalleryState
}
Widget _appBar() {
final fullScreenReader = ref.watch(fullScreenReaderStateProvider);
double height = _isView
? Platform.isIOS
? 120
: !fullScreenReader && !isDesktop
? 55
: 80
: 0;
return Positioned(
top: 0,
child: AnimatedContainer(
width: context.mediaWidth(1),
height: _isView
? Platform.isIOS
? 120
: 80
: 0,
height: height,
curve: Curves.ease,
duration: const Duration(milliseconds: 200),
child: PreferredSize(
preferredSize: Size.fromHeight(_isView
? Platform.isIOS
? 120
: 80
: 0),
preferredSize: Size.fromHeight(height),
child: AppBar(
centerTitle: false,
automaticallyImplyLeading: false,
@ -1620,17 +1614,19 @@ class _MangaChapterPageGalleryState
}
void _isViewFunction() {
final fullScreenReader = ref.watch(fullScreenReaderStateProvider);
if (mounted) {
setState(() {
_isView = !_isView;
});
}
if (_isView) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
} else {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
if (fullScreenReader) {
if (_isView) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values);
} else {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
}
}
}
@ -1803,7 +1799,7 @@ class _MangaChapterPageGalleryState
await DraggableMenu.open(
context,
DraggableMenu(
ui: SoftModernDraggableMenu(barItem: Container(), radius: 20),
ui: ClassicDraggableMenu(barItem: Container(), radius: 20),
minimizeThreshold: 0.6,
levels: [
DraggableMenuLevel.ratio(ratio: 1.5 / 3),
@ -1951,6 +1947,8 @@ class _MangaChapterPageGalleryState
final animatePageTransitions =
ref.watch(animatePageTransitionsStateProvider);
final scaleType = ref.watch(scaleTypeStateProvider);
final fullScreenReader =
ref.watch(fullScreenReaderStateProvider);
final backgroundColor =
ref.watch(backgroundColorStateProvider);
return SingleChildScrollView(
@ -2002,6 +2000,21 @@ class _MangaChapterPageGalleryState
context)[scale.index];
},
),
SwitchListTile(
value: fullScreenReader,
title: Text(
l10n.fullscreen,
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyLarge!
.color!
.withOpacity(0.9),
fontSize: 14),
),
onChanged: (value) {
_setFullScreen(value: value);
}),
SwitchListTile(
value: showPageNumber,
title: Text(

View file

@ -9,6 +9,8 @@ import 'package:mangayomi/modules/more/settings/appearance/providers/pure_black_
import 'package:mangayomi/modules/more/settings/appearance/widgets/blend_level_slider.dart';
import 'package:mangayomi/modules/more/settings/appearance/widgets/dark_mode_button.dart';
import 'package:mangayomi/modules/more/settings/appearance/widgets/theme_selector.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:mangayomi/utils/language.dart';
class AppearanceScreen extends ConsumerWidget {
const AppearanceScreen({super.key});
@ -20,6 +22,7 @@ class AppearanceScreen extends ConsumerWidget {
final relativeTimestamps = ref.watch(relativeTimesTampsStateProvider);
final pureBlackDarkMode = ref.watch(pureBlackDarkModeStateProvider);
final isDarkTheme = ref.watch(themeModeStateProvider);
final l10nLocale = ref.watch(l10nLocaleStateProvider);
return Scaffold(
appBar: AppBar(
title: Text(l10n!.appearance),
@ -28,7 +31,7 @@ class AppearanceScreen extends ConsumerWidget {
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 30),
padding: const EdgeInsets.only(bottom: 10),
child: Column(
children: [
Padding(
@ -60,6 +63,84 @@ class AppearanceScreen extends ConsumerWidget {
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Row(
children: [
Text(l10n.appearance,
style: TextStyle(
fontSize: 13, color: context.primaryColor)),
],
),
),
ListTile(
onTap: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
l10n.app_language,
),
content: SizedBox(
width: context.mediaWidth(0.8),
child: ListView.builder(
shrinkWrap: true,
itemCount: AppLocalizations
.supportedLocales.length,
itemBuilder: (context, index) {
final locale = AppLocalizations
.supportedLocales[index];
return RadioListTile(
dense: true,
contentPadding: const EdgeInsets.all(0),
value: locale,
groupValue: l10nLocale,
onChanged: (value) {
ref
.read(l10nLocaleStateProvider
.notifier)
.setLocale(locale);
Navigator.pop(context);
},
title: Text(completeLanguageName(
locale.toLanguageTag())),
);
},
)),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () async {
Navigator.pop(context);
},
child: Text(
l10n.cancel,
style: TextStyle(
color: context.primaryColor),
)),
],
)
],
);
});
},
title: Text(l10n.app_language),
subtitle: Text(
completeLanguageName(l10nLocale.toLanguageTag()),
style: TextStyle(
fontSize: 11, color: context.secondaryColor),
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Column(

View file

@ -122,3 +122,18 @@ class UsePageTapZonesState extends _$UsePageTapZonesState {
() => isar.settings.putSync(settings!..usePageTapZones = value));
}
}
@riverpod
class FullScreenReaderState extends _$FullScreenReaderState {
@override
bool build() {
return isar.settings.getSync(227)!.fullScreenReader ?? true;
}
void set(bool value) {
final settings = isar.settings.getSync(227);
state = value;
isar.writeTxnSync(
() => isar.settings.putSync(settings!..fullScreenReader = value));
}
}

View file

@ -140,5 +140,22 @@ final usePageTapZonesStateProvider =
);
typedef _$UsePageTapZonesState = AutoDisposeNotifier<bool>;
String _$fullScreenReaderStateHash() =>
r'fe95b7d8cb6aee8910466f86bba97c854994b2d1';
/// See also [FullScreenReaderState].
@ProviderFor(FullScreenReaderState)
final fullScreenReaderStateProvider =
AutoDisposeNotifierProvider<FullScreenReaderState, bool>.internal(
FullScreenReaderState.new,
name: r'fullScreenReaderStateProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$fullScreenReaderStateHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$FullScreenReaderState = AutoDisposeNotifier<bool>;
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member

View file

@ -20,6 +20,7 @@ class ReaderScreen extends ConsumerWidget {
final scaleType = ref.watch(scaleTypeStateProvider);
final backgroundColor = ref.watch(backgroundColorStateProvider);
final usePageTapZones = ref.watch(usePageTapZonesStateProvider);
final fullScreenReader = ref.watch(fullScreenReaderStateProvider);
return Scaffold(
appBar: AppBar(
title: Text(context.l10n.reader),
@ -327,6 +328,12 @@ class ReaderScreen extends ConsumerWidget {
style: TextStyle(fontSize: 11, color: context.secondaryColor),
),
),
SwitchListTile(
value: fullScreenReader,
title: Text(context.l10n.fullscreen),
onChanged: (value) {
ref.read(fullScreenReaderStateProvider.notifier).set(value);
}),
SwitchListTile(
value: animatePageTransitions,
title: Text(context.l10n.animate_page_transitions),

View file

@ -16,11 +16,6 @@ class SettingsScreen extends StatelessWidget {
body: SingleChildScrollView(
child: Column(
children: [
ListTileWidget(
title: l10n.general,
subtitle: l10n.general_subtitle,
icon: Icons.tune_rounded,
onTap: () => context.push('/general')),
ListTileWidget(
title: l10n.appearance,
subtitle: l10n.appearance_subtitle,

View file

@ -302,7 +302,6 @@ class MyInAppBrowser extends InAppBrowser {
late BuildContext context;
@override
Future onBrowserCreated() async {
print("\n\nBrowser Created!\n\n");
}
@override
@ -312,9 +311,9 @@ class MyInAppBrowser extends InAppBrowser {
Future onLoadStop(url) async {}
@override
Future<PermissionResponse> onPermissionRequest(request) async {
Future<PermissionResponse> onPermissionRequest(permissionRequest) async {
return PermissionResponse(
resources: request.resources, action: PermissionResponseAction.GRANT);
resources: permissionRequest.resources, action: PermissionResponseAction.GRANT);
}
@override

View file

@ -98,7 +98,7 @@ class StorageProvider {
}
}
Future<Isar> initDB(String? path, {bool? inspector = true}) async {
Future<Isar> initDB(String? path, {bool? inspector = false}) async {
Directory? dir;
if (path == null) {
dir = await getDatabaseDirectory();