Merge pull request #351 from Schnitzel5/novel/font-size

added option to adjust reader font size
This commit is contained in:
Moustapha Kodjo Amadou 2025-01-07 13:25:06 +01:00 committed by GitHub
commit 9eb49c7af6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 766 additions and 273 deletions

View file

@ -215,6 +215,11 @@ class Settings {
@enumerated @enumerated
late DisplayType novelDisplayType; late DisplayType novelDisplayType;
int? novelFontSize;
@enumerated
late NovelTextAlign novelTextAlign;
bool? hideManga; bool? hideManga;
bool? hideAnime; bool? hideAnime;
@ -318,6 +323,8 @@ class Settings {
this.novelLibraryLocalSource, this.novelLibraryLocalSource,
this.sortLibraryNovel, this.sortLibraryNovel,
this.novelDisplayType = DisplayType.comfortableGrid, this.novelDisplayType = DisplayType.comfortableGrid,
this.novelFontSize = 14,
this.novelTextAlign = NovelTextAlign.left,
this.hideManga = false, this.hideManga = false,
this.hideAnime = false, this.hideAnime = false,
this.hideNovel = false, this.hideNovel = false,
@ -491,6 +498,11 @@ class Settings {
: null; : null;
novelDisplayType = DisplayType novelDisplayType = DisplayType
.values[json['novelDisplayType'] ?? DisplayType.comfortableGrid.index]; .values[json['novelDisplayType'] ?? DisplayType.comfortableGrid.index];
if (json['novelFontSize'] != null) {
novelFontSize = json['novelFontSize'];
}
novelTextAlign = NovelTextAlign
.values[json['novelTextAlign'] ?? NovelTextAlign.left.index];
hideManga = json['hideManga']; hideManga = json['hideManga'];
hideAnime = json['hideAnime']; hideAnime = json['hideAnime'];
hideNovel = json['hideNovel']; hideNovel = json['hideNovel'];
@ -607,6 +619,8 @@ class Settings {
'novelLibraryLocalSource': novelLibraryLocalSource, 'novelLibraryLocalSource': novelLibraryLocalSource,
'sortLibraryNovel': sortLibraryNovel?.toJson(), 'sortLibraryNovel': sortLibraryNovel?.toJson(),
'novelDisplayType': novelDisplayType.index, 'novelDisplayType': novelDisplayType.index,
'novelFontSize': novelFontSize,
'novelTextAlign': novelTextAlign.index,
'hideManga': hideManga, 'hideManga': hideManga,
'hideAnime': hideAnime, 'hideAnime': hideAnime,
'hideNovel': hideNovel, 'hideNovel': hideNovel,
@ -809,6 +823,8 @@ enum ReaderMode {
horizontalContinuous horizontalContinuous
} }
enum NovelTextAlign { left, center, right, block }
enum PageMode { onePage, doublePage } enum PageMode { onePage, doublePage }
@embedded @embedded

View file

@ -410,146 +410,157 @@ const SettingsSchema = CollectionSchema(
type: IsarType.byte, type: IsarType.byte,
enumMap: _SettingsnovelDisplayTypeEnumValueMap, enumMap: _SettingsnovelDisplayTypeEnumValueMap,
), ),
r'novelGridSize': PropertySchema( r'novelFontSize': PropertySchema(
id: 75, id: 75,
name: r'novelFontSize',
type: IsarType.long,
),
r'novelGridSize': PropertySchema(
id: 76,
name: r'novelGridSize', name: r'novelGridSize',
type: IsarType.long, type: IsarType.long,
), ),
r'novelLibraryDownloadedChapters': PropertySchema( r'novelLibraryDownloadedChapters': PropertySchema(
id: 76, id: 77,
name: r'novelLibraryDownloadedChapters', name: r'novelLibraryDownloadedChapters',
type: IsarType.bool, type: IsarType.bool,
), ),
r'novelLibraryLocalSource': PropertySchema( r'novelLibraryLocalSource': PropertySchema(
id: 77, id: 78,
name: r'novelLibraryLocalSource', name: r'novelLibraryLocalSource',
type: IsarType.bool, type: IsarType.bool,
), ),
r'novelLibraryShowCategoryTabs': PropertySchema( r'novelLibraryShowCategoryTabs': PropertySchema(
id: 78, id: 79,
name: r'novelLibraryShowCategoryTabs', name: r'novelLibraryShowCategoryTabs',
type: IsarType.bool, type: IsarType.bool,
), ),
r'novelLibraryShowContinueReadingButton': PropertySchema( r'novelLibraryShowContinueReadingButton': PropertySchema(
id: 79, id: 80,
name: r'novelLibraryShowContinueReadingButton', name: r'novelLibraryShowContinueReadingButton',
type: IsarType.bool, type: IsarType.bool,
), ),
r'novelLibraryShowLanguage': PropertySchema( r'novelLibraryShowLanguage': PropertySchema(
id: 80, id: 81,
name: r'novelLibraryShowLanguage', name: r'novelLibraryShowLanguage',
type: IsarType.bool, type: IsarType.bool,
), ),
r'novelLibraryShowNumbersOfItems': PropertySchema( r'novelLibraryShowNumbersOfItems': PropertySchema(
id: 81, id: 82,
name: r'novelLibraryShowNumbersOfItems', name: r'novelLibraryShowNumbersOfItems',
type: IsarType.bool, type: IsarType.bool,
), ),
r'novelTextAlign': PropertySchema(
id: 83,
name: r'novelTextAlign',
type: IsarType.byte,
enumMap: _SettingsnovelTextAlignEnumValueMap,
),
r'onlyIncludePinnedSources': PropertySchema( r'onlyIncludePinnedSources': PropertySchema(
id: 82, id: 84,
name: r'onlyIncludePinnedSources', name: r'onlyIncludePinnedSources',
type: IsarType.bool, type: IsarType.bool,
), ),
r'pagePreloadAmount': PropertySchema( r'pagePreloadAmount': PropertySchema(
id: 83, id: 85,
name: r'pagePreloadAmount', name: r'pagePreloadAmount',
type: IsarType.long, type: IsarType.long,
), ),
r'personalPageModeList': PropertySchema( r'personalPageModeList': PropertySchema(
id: 84, id: 86,
name: r'personalPageModeList', name: r'personalPageModeList',
type: IsarType.objectList, type: IsarType.objectList,
target: r'PersonalPageMode', target: r'PersonalPageMode',
), ),
r'personalReaderModeList': PropertySchema( r'personalReaderModeList': PropertySchema(
id: 85, id: 87,
name: r'personalReaderModeList', name: r'personalReaderModeList',
type: IsarType.objectList, type: IsarType.objectList,
target: r'PersonalReaderMode', target: r'PersonalReaderMode',
), ),
r'playerSubtitleSettings': PropertySchema( r'playerSubtitleSettings': PropertySchema(
id: 86, id: 88,
name: r'playerSubtitleSettings', name: r'playerSubtitleSettings',
type: IsarType.object, type: IsarType.object,
target: r'PlayerSubtitleSettings', target: r'PlayerSubtitleSettings',
), ),
r'pureBlackDarkMode': PropertySchema( r'pureBlackDarkMode': PropertySchema(
id: 87, id: 89,
name: r'pureBlackDarkMode', name: r'pureBlackDarkMode',
type: IsarType.bool, type: IsarType.bool,
), ),
r'relativeTimesTamps': PropertySchema( r'relativeTimesTamps': PropertySchema(
id: 88, id: 90,
name: r'relativeTimesTamps', name: r'relativeTimesTamps',
type: IsarType.long, type: IsarType.long,
), ),
r'saveAsCBZArchive': PropertySchema( r'saveAsCBZArchive': PropertySchema(
id: 89, id: 91,
name: r'saveAsCBZArchive', name: r'saveAsCBZArchive',
type: IsarType.bool, type: IsarType.bool,
), ),
r'scaleType': PropertySchema( r'scaleType': PropertySchema(
id: 90, id: 92,
name: r'scaleType', name: r'scaleType',
type: IsarType.byte, type: IsarType.byte,
enumMap: _SettingsscaleTypeEnumValueMap, enumMap: _SettingsscaleTypeEnumValueMap,
), ),
r'showPagesNumber': PropertySchema( r'showPagesNumber': PropertySchema(
id: 91, id: 93,
name: r'showPagesNumber', name: r'showPagesNumber',
type: IsarType.bool, type: IsarType.bool,
), ),
r'sortChapterList': PropertySchema( r'sortChapterList': PropertySchema(
id: 92, id: 94,
name: r'sortChapterList', name: r'sortChapterList',
type: IsarType.objectList, type: IsarType.objectList,
target: r'SortChapter', target: r'SortChapter',
), ),
r'sortLibraryAnime': PropertySchema( r'sortLibraryAnime': PropertySchema(
id: 93, id: 95,
name: r'sortLibraryAnime', name: r'sortLibraryAnime',
type: IsarType.object, type: IsarType.object,
target: r'SortLibraryManga', target: r'SortLibraryManga',
), ),
r'sortLibraryManga': PropertySchema( r'sortLibraryManga': PropertySchema(
id: 94, id: 96,
name: r'sortLibraryManga', name: r'sortLibraryManga',
type: IsarType.object, type: IsarType.object,
target: r'SortLibraryManga', target: r'SortLibraryManga',
), ),
r'sortLibraryNovel': PropertySchema( r'sortLibraryNovel': PropertySchema(
id: 95, id: 97,
name: r'sortLibraryNovel', name: r'sortLibraryNovel',
type: IsarType.object, type: IsarType.object,
target: r'SortLibraryManga', target: r'SortLibraryManga',
), ),
r'startDatebackup': PropertySchema( r'startDatebackup': PropertySchema(
id: 96, id: 98,
name: r'startDatebackup', name: r'startDatebackup',
type: IsarType.long, type: IsarType.long,
), ),
r'themeIsDark': PropertySchema( r'themeIsDark': PropertySchema(
id: 97, id: 99,
name: r'themeIsDark', name: r'themeIsDark',
type: IsarType.bool, type: IsarType.bool,
), ),
r'updateProgressAfterReading': PropertySchema( r'updateProgressAfterReading': PropertySchema(
id: 98, id: 100,
name: r'updateProgressAfterReading', name: r'updateProgressAfterReading',
type: IsarType.bool, type: IsarType.bool,
), ),
r'useLibass': PropertySchema( r'useLibass': PropertySchema(
id: 99, id: 101,
name: r'useLibass', name: r'useLibass',
type: IsarType.bool, type: IsarType.bool,
), ),
r'usePageTapZones': PropertySchema( r'usePageTapZones': PropertySchema(
id: 100, id: 102,
name: r'usePageTapZones', name: r'usePageTapZones',
type: IsarType.bool, type: IsarType.bool,
), ),
r'userAgent': PropertySchema( r'userAgent': PropertySchema(
id: 101, id: 103,
name: r'userAgent', name: r'userAgent',
type: IsarType.string, type: IsarType.string,
) )
@ -974,68 +985,70 @@ void _settingsSerialize(
writer.writeByte(offsets[72], object.mangaHomeDisplayType.index); writer.writeByte(offsets[72], object.mangaHomeDisplayType.index);
writer.writeLong(offsets[73], object.markEpisodeAsSeenType); writer.writeLong(offsets[73], object.markEpisodeAsSeenType);
writer.writeByte(offsets[74], object.novelDisplayType.index); writer.writeByte(offsets[74], object.novelDisplayType.index);
writer.writeLong(offsets[75], object.novelGridSize); writer.writeLong(offsets[75], object.novelFontSize);
writer.writeBool(offsets[76], object.novelLibraryDownloadedChapters); writer.writeLong(offsets[76], object.novelGridSize);
writer.writeBool(offsets[77], object.novelLibraryLocalSource); writer.writeBool(offsets[77], object.novelLibraryDownloadedChapters);
writer.writeBool(offsets[78], object.novelLibraryShowCategoryTabs); writer.writeBool(offsets[78], object.novelLibraryLocalSource);
writer.writeBool(offsets[79], object.novelLibraryShowContinueReadingButton); writer.writeBool(offsets[79], object.novelLibraryShowCategoryTabs);
writer.writeBool(offsets[80], object.novelLibraryShowLanguage); writer.writeBool(offsets[80], object.novelLibraryShowContinueReadingButton);
writer.writeBool(offsets[81], object.novelLibraryShowNumbersOfItems); writer.writeBool(offsets[81], object.novelLibraryShowLanguage);
writer.writeBool(offsets[82], object.onlyIncludePinnedSources); writer.writeBool(offsets[82], object.novelLibraryShowNumbersOfItems);
writer.writeLong(offsets[83], object.pagePreloadAmount); writer.writeByte(offsets[83], object.novelTextAlign.index);
writer.writeBool(offsets[84], object.onlyIncludePinnedSources);
writer.writeLong(offsets[85], object.pagePreloadAmount);
writer.writeObjectList<PersonalPageMode>( writer.writeObjectList<PersonalPageMode>(
offsets[84], offsets[86],
allOffsets, allOffsets,
PersonalPageModeSchema.serialize, PersonalPageModeSchema.serialize,
object.personalPageModeList, object.personalPageModeList,
); );
writer.writeObjectList<PersonalReaderMode>( writer.writeObjectList<PersonalReaderMode>(
offsets[85], offsets[87],
allOffsets, allOffsets,
PersonalReaderModeSchema.serialize, PersonalReaderModeSchema.serialize,
object.personalReaderModeList, object.personalReaderModeList,
); );
writer.writeObject<PlayerSubtitleSettings>( writer.writeObject<PlayerSubtitleSettings>(
offsets[86], offsets[88],
allOffsets, allOffsets,
PlayerSubtitleSettingsSchema.serialize, PlayerSubtitleSettingsSchema.serialize,
object.playerSubtitleSettings, object.playerSubtitleSettings,
); );
writer.writeBool(offsets[87], object.pureBlackDarkMode); writer.writeBool(offsets[89], object.pureBlackDarkMode);
writer.writeLong(offsets[88], object.relativeTimesTamps); writer.writeLong(offsets[90], object.relativeTimesTamps);
writer.writeBool(offsets[89], object.saveAsCBZArchive); writer.writeBool(offsets[91], object.saveAsCBZArchive);
writer.writeByte(offsets[90], object.scaleType.index); writer.writeByte(offsets[92], object.scaleType.index);
writer.writeBool(offsets[91], object.showPagesNumber); writer.writeBool(offsets[93], object.showPagesNumber);
writer.writeObjectList<SortChapter>( writer.writeObjectList<SortChapter>(
offsets[92], offsets[94],
allOffsets, allOffsets,
SortChapterSchema.serialize, SortChapterSchema.serialize,
object.sortChapterList, object.sortChapterList,
); );
writer.writeObject<SortLibraryManga>( writer.writeObject<SortLibraryManga>(
offsets[93], offsets[95],
allOffsets, allOffsets,
SortLibraryMangaSchema.serialize, SortLibraryMangaSchema.serialize,
object.sortLibraryAnime, object.sortLibraryAnime,
); );
writer.writeObject<SortLibraryManga>( writer.writeObject<SortLibraryManga>(
offsets[94], offsets[96],
allOffsets, allOffsets,
SortLibraryMangaSchema.serialize, SortLibraryMangaSchema.serialize,
object.sortLibraryManga, object.sortLibraryManga,
); );
writer.writeObject<SortLibraryManga>( writer.writeObject<SortLibraryManga>(
offsets[95], offsets[97],
allOffsets, allOffsets,
SortLibraryMangaSchema.serialize, SortLibraryMangaSchema.serialize,
object.sortLibraryNovel, object.sortLibraryNovel,
); );
writer.writeLong(offsets[96], object.startDatebackup); writer.writeLong(offsets[98], object.startDatebackup);
writer.writeBool(offsets[97], object.themeIsDark); writer.writeBool(offsets[99], object.themeIsDark);
writer.writeBool(offsets[98], object.updateProgressAfterReading); writer.writeBool(offsets[100], object.updateProgressAfterReading);
writer.writeBool(offsets[99], object.useLibass); writer.writeBool(offsets[101], object.useLibass);
writer.writeBool(offsets[100], object.usePageTapZones); writer.writeBool(offsets[102], object.usePageTapZones);
writer.writeString(offsets[101], object.userAgent); writer.writeString(offsets[103], object.userAgent);
} }
Settings _settingsDeserialize( Settings _settingsDeserialize(
@ -1162,65 +1175,69 @@ Settings _settingsDeserialize(
novelDisplayType: _SettingsnovelDisplayTypeValueEnumMap[ novelDisplayType: _SettingsnovelDisplayTypeValueEnumMap[
reader.readByteOrNull(offsets[74])] ?? reader.readByteOrNull(offsets[74])] ??
DisplayType.comfortableGrid, DisplayType.comfortableGrid,
novelLibraryDownloadedChapters: reader.readBoolOrNull(offsets[76]), novelFontSize: reader.readLongOrNull(offsets[75]),
novelLibraryLocalSource: reader.readBoolOrNull(offsets[77]), novelLibraryDownloadedChapters: reader.readBoolOrNull(offsets[77]),
novelLibraryShowCategoryTabs: reader.readBoolOrNull(offsets[78]), novelLibraryLocalSource: reader.readBoolOrNull(offsets[78]),
novelLibraryShowContinueReadingButton: reader.readBoolOrNull(offsets[79]), novelLibraryShowCategoryTabs: reader.readBoolOrNull(offsets[79]),
novelLibraryShowLanguage: reader.readBoolOrNull(offsets[80]), novelLibraryShowContinueReadingButton: reader.readBoolOrNull(offsets[80]),
novelLibraryShowNumbersOfItems: reader.readBoolOrNull(offsets[81]), novelLibraryShowLanguage: reader.readBoolOrNull(offsets[81]),
onlyIncludePinnedSources: reader.readBoolOrNull(offsets[82]), novelLibraryShowNumbersOfItems: reader.readBoolOrNull(offsets[82]),
pagePreloadAmount: reader.readLongOrNull(offsets[83]), novelTextAlign: _SettingsnovelTextAlignValueEnumMap[
reader.readByteOrNull(offsets[83])] ??
NovelTextAlign.left,
onlyIncludePinnedSources: reader.readBoolOrNull(offsets[84]),
pagePreloadAmount: reader.readLongOrNull(offsets[85]),
personalPageModeList: reader.readObjectList<PersonalPageMode>( personalPageModeList: reader.readObjectList<PersonalPageMode>(
offsets[84], offsets[86],
PersonalPageModeSchema.deserialize, PersonalPageModeSchema.deserialize,
allOffsets, allOffsets,
PersonalPageMode(), PersonalPageMode(),
), ),
personalReaderModeList: reader.readObjectList<PersonalReaderMode>( personalReaderModeList: reader.readObjectList<PersonalReaderMode>(
offsets[85], offsets[87],
PersonalReaderModeSchema.deserialize, PersonalReaderModeSchema.deserialize,
allOffsets, allOffsets,
PersonalReaderMode(), PersonalReaderMode(),
), ),
playerSubtitleSettings: reader.readObjectOrNull<PlayerSubtitleSettings>( playerSubtitleSettings: reader.readObjectOrNull<PlayerSubtitleSettings>(
offsets[86], offsets[88],
PlayerSubtitleSettingsSchema.deserialize, PlayerSubtitleSettingsSchema.deserialize,
allOffsets, allOffsets,
), ),
pureBlackDarkMode: reader.readBoolOrNull(offsets[87]), pureBlackDarkMode: reader.readBoolOrNull(offsets[89]),
relativeTimesTamps: reader.readLongOrNull(offsets[88]), relativeTimesTamps: reader.readLongOrNull(offsets[90]),
saveAsCBZArchive: reader.readBoolOrNull(offsets[89]), saveAsCBZArchive: reader.readBoolOrNull(offsets[91]),
scaleType: scaleType:
_SettingsscaleTypeValueEnumMap[reader.readByteOrNull(offsets[90])] ?? _SettingsscaleTypeValueEnumMap[reader.readByteOrNull(offsets[92])] ??
ScaleType.fitScreen, ScaleType.fitScreen,
showPagesNumber: reader.readBoolOrNull(offsets[91]), showPagesNumber: reader.readBoolOrNull(offsets[93]),
sortChapterList: reader.readObjectList<SortChapter>( sortChapterList: reader.readObjectList<SortChapter>(
offsets[92], offsets[94],
SortChapterSchema.deserialize, SortChapterSchema.deserialize,
allOffsets, allOffsets,
SortChapter(), SortChapter(),
), ),
sortLibraryAnime: reader.readObjectOrNull<SortLibraryManga>( sortLibraryAnime: reader.readObjectOrNull<SortLibraryManga>(
offsets[93],
SortLibraryMangaSchema.deserialize,
allOffsets,
),
sortLibraryManga: reader.readObjectOrNull<SortLibraryManga>(
offsets[94],
SortLibraryMangaSchema.deserialize,
allOffsets,
),
sortLibraryNovel: reader.readObjectOrNull<SortLibraryManga>(
offsets[95], offsets[95],
SortLibraryMangaSchema.deserialize, SortLibraryMangaSchema.deserialize,
allOffsets, allOffsets,
), ),
startDatebackup: reader.readLongOrNull(offsets[96]), sortLibraryManga: reader.readObjectOrNull<SortLibraryManga>(
themeIsDark: reader.readBoolOrNull(offsets[97]), offsets[96],
updateProgressAfterReading: reader.readBoolOrNull(offsets[98]), SortLibraryMangaSchema.deserialize,
useLibass: reader.readBoolOrNull(offsets[99]), allOffsets,
usePageTapZones: reader.readBoolOrNull(offsets[100]), ),
userAgent: reader.readStringOrNull(offsets[101]), sortLibraryNovel: reader.readObjectOrNull<SortLibraryManga>(
offsets[97],
SortLibraryMangaSchema.deserialize,
allOffsets,
),
startDatebackup: reader.readLongOrNull(offsets[98]),
themeIsDark: reader.readBoolOrNull(offsets[99]),
updateProgressAfterReading: reader.readBoolOrNull(offsets[100]),
useLibass: reader.readBoolOrNull(offsets[101]),
usePageTapZones: reader.readBoolOrNull(offsets[102]),
userAgent: reader.readStringOrNull(offsets[103]),
); );
object.chapterFilterBookmarkedList = object.chapterFilterBookmarkedList =
reader.readObjectList<ChapterFilterBookmarked>( reader.readObjectList<ChapterFilterBookmarked>(
@ -1246,7 +1263,7 @@ Settings _settingsDeserialize(
L10nLocaleSchema.deserialize, L10nLocaleSchema.deserialize,
allOffsets, allOffsets,
); );
object.novelGridSize = reader.readLongOrNull(offsets[75]); object.novelGridSize = reader.readLongOrNull(offsets[76]);
return object; return object;
} }
@ -1473,7 +1490,7 @@ P _settingsDeserializeProp<P>(
case 75: case 75:
return (reader.readLongOrNull(offset)) as P; return (reader.readLongOrNull(offset)) as P;
case 76: case 76:
return (reader.readBoolOrNull(offset)) as P; return (reader.readLongOrNull(offset)) as P;
case 77: case 77:
return (reader.readBoolOrNull(offset)) as P; return (reader.readBoolOrNull(offset)) as P;
case 78: case 78:
@ -1487,57 +1504,51 @@ P _settingsDeserializeProp<P>(
case 82: case 82:
return (reader.readBoolOrNull(offset)) as P; return (reader.readBoolOrNull(offset)) as P;
case 83: case 83:
return (reader.readLongOrNull(offset)) as P; return (_SettingsnovelTextAlignValueEnumMap[
reader.readByteOrNull(offset)] ??
NovelTextAlign.left) as P;
case 84: case 84:
return (reader.readBoolOrNull(offset)) as P;
case 85:
return (reader.readLongOrNull(offset)) as P;
case 86:
return (reader.readObjectList<PersonalPageMode>( return (reader.readObjectList<PersonalPageMode>(
offset, offset,
PersonalPageModeSchema.deserialize, PersonalPageModeSchema.deserialize,
allOffsets, allOffsets,
PersonalPageMode(), PersonalPageMode(),
)) as P; )) as P;
case 85: case 87:
return (reader.readObjectList<PersonalReaderMode>( return (reader.readObjectList<PersonalReaderMode>(
offset, offset,
PersonalReaderModeSchema.deserialize, PersonalReaderModeSchema.deserialize,
allOffsets, allOffsets,
PersonalReaderMode(), PersonalReaderMode(),
)) as P; )) as P;
case 86: case 88:
return (reader.readObjectOrNull<PlayerSubtitleSettings>( return (reader.readObjectOrNull<PlayerSubtitleSettings>(
offset, offset,
PlayerSubtitleSettingsSchema.deserialize, PlayerSubtitleSettingsSchema.deserialize,
allOffsets, allOffsets,
)) as P; )) as P;
case 87:
return (reader.readBoolOrNull(offset)) as P;
case 88:
return (reader.readLongOrNull(offset)) as P;
case 89: case 89:
return (reader.readBoolOrNull(offset)) as P; return (reader.readBoolOrNull(offset)) as P;
case 90: case 90:
return (_SettingsscaleTypeValueEnumMap[reader.readByteOrNull(offset)] ?? return (reader.readLongOrNull(offset)) as P;
ScaleType.fitScreen) as P;
case 91: case 91:
return (reader.readBoolOrNull(offset)) as P; return (reader.readBoolOrNull(offset)) as P;
case 92: case 92:
return (_SettingsscaleTypeValueEnumMap[reader.readByteOrNull(offset)] ??
ScaleType.fitScreen) as P;
case 93:
return (reader.readBoolOrNull(offset)) as P;
case 94:
return (reader.readObjectList<SortChapter>( return (reader.readObjectList<SortChapter>(
offset, offset,
SortChapterSchema.deserialize, SortChapterSchema.deserialize,
allOffsets, allOffsets,
SortChapter(), SortChapter(),
)) as P; )) as P;
case 93:
return (reader.readObjectOrNull<SortLibraryManga>(
offset,
SortLibraryMangaSchema.deserialize,
allOffsets,
)) as P;
case 94:
return (reader.readObjectOrNull<SortLibraryManga>(
offset,
SortLibraryMangaSchema.deserialize,
allOffsets,
)) as P;
case 95: case 95:
return (reader.readObjectOrNull<SortLibraryManga>( return (reader.readObjectOrNull<SortLibraryManga>(
offset, offset,
@ -1545,16 +1556,28 @@ P _settingsDeserializeProp<P>(
allOffsets, allOffsets,
)) as P; )) as P;
case 96: case 96:
return (reader.readLongOrNull(offset)) as P; return (reader.readObjectOrNull<SortLibraryManga>(
offset,
SortLibraryMangaSchema.deserialize,
allOffsets,
)) as P;
case 97: case 97:
return (reader.readBoolOrNull(offset)) as P; return (reader.readObjectOrNull<SortLibraryManga>(
offset,
SortLibraryMangaSchema.deserialize,
allOffsets,
)) as P;
case 98: case 98:
return (reader.readBoolOrNull(offset)) as P; return (reader.readLongOrNull(offset)) as P;
case 99: case 99:
return (reader.readBoolOrNull(offset)) as P; return (reader.readBoolOrNull(offset)) as P;
case 100: case 100:
return (reader.readBoolOrNull(offset)) as P; return (reader.readBoolOrNull(offset)) as P;
case 101: case 101:
return (reader.readBoolOrNull(offset)) as P;
case 102:
return (reader.readBoolOrNull(offset)) as P;
case 103:
return (reader.readStringOrNull(offset)) as P; return (reader.readStringOrNull(offset)) as P;
default: default:
throw IsarError('Unknown property with id $propertyId'); throw IsarError('Unknown property with id $propertyId');
@ -1677,6 +1700,18 @@ const _SettingsnovelDisplayTypeValueEnumMap = {
2: DisplayType.coverOnlyGrid, 2: DisplayType.coverOnlyGrid,
3: DisplayType.list, 3: DisplayType.list,
}; };
const _SettingsnovelTextAlignEnumValueMap = {
'left': 0,
'center': 1,
'right': 2,
'block': 3,
};
const _SettingsnovelTextAlignValueEnumMap = {
0: NovelTextAlign.left,
1: NovelTextAlign.center,
2: NovelTextAlign.right,
3: NovelTextAlign.block,
};
const _SettingsscaleTypeEnumValueMap = { const _SettingsscaleTypeEnumValueMap = {
'fitScreen': 0, 'fitScreen': 0,
'stretch': 1, 'stretch': 1,
@ -6649,6 +6684,78 @@ extension SettingsQueryFilter
}); });
} }
QueryBuilder<Settings, Settings, QAfterFilterCondition>
novelFontSizeIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNull(
property: r'novelFontSize',
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition>
novelFontSizeIsNotNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNotNull(
property: r'novelFontSize',
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition> novelFontSizeEqualTo(
int? value) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.equalTo(
property: r'novelFontSize',
value: value,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition>
novelFontSizeGreaterThan(
int? value, {
bool include = false,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.greaterThan(
include: include,
property: r'novelFontSize',
value: value,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition> novelFontSizeLessThan(
int? value, {
bool include = false,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.lessThan(
include: include,
property: r'novelFontSize',
value: value,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition> novelFontSizeBetween(
int? lower,
int? upper, {
bool includeLower = true,
bool includeUpper = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.between(
property: r'novelFontSize',
lower: lower,
includeLower: includeLower,
upper: upper,
includeUpper: includeUpper,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition> QueryBuilder<Settings, Settings, QAfterFilterCondition>
novelGridSizeIsNull() { novelGridSizeIsNull() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
@ -6889,6 +6996,61 @@ extension SettingsQueryFilter
}); });
} }
QueryBuilder<Settings, Settings, QAfterFilterCondition> novelTextAlignEqualTo(
NovelTextAlign value) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.equalTo(
property: r'novelTextAlign',
value: value,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition>
novelTextAlignGreaterThan(
NovelTextAlign value, {
bool include = false,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.greaterThan(
include: include,
property: r'novelTextAlign',
value: value,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition>
novelTextAlignLessThan(
NovelTextAlign value, {
bool include = false,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.lessThan(
include: include,
property: r'novelTextAlign',
value: value,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition> novelTextAlignBetween(
NovelTextAlign lower,
NovelTextAlign upper, {
bool includeLower = true,
bool includeUpper = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.between(
property: r'novelTextAlign',
lower: lower,
includeLower: includeLower,
upper: upper,
includeUpper: includeUpper,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition> QueryBuilder<Settings, Settings, QAfterFilterCondition>
onlyIncludePinnedSourcesIsNull() { onlyIncludePinnedSourcesIsNull() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
@ -8953,6 +9115,18 @@ extension SettingsQuerySortBy on QueryBuilder<Settings, Settings, QSortBy> {
}); });
} }
QueryBuilder<Settings, Settings, QAfterSortBy> sortByNovelFontSize() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelFontSize', Sort.asc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> sortByNovelFontSizeDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelFontSize', Sort.desc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> sortByNovelGridSize() { QueryBuilder<Settings, Settings, QAfterSortBy> sortByNovelGridSize() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelGridSize', Sort.asc); return query.addSortBy(r'novelGridSize', Sort.asc);
@ -9051,6 +9225,18 @@ extension SettingsQuerySortBy on QueryBuilder<Settings, Settings, QSortBy> {
}); });
} }
QueryBuilder<Settings, Settings, QAfterSortBy> sortByNovelTextAlign() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelTextAlign', Sort.asc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> sortByNovelTextAlignDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelTextAlign', Sort.desc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> QueryBuilder<Settings, Settings, QAfterSortBy>
sortByOnlyIncludePinnedSources() { sortByOnlyIncludePinnedSources() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
@ -10069,6 +10255,18 @@ extension SettingsQuerySortThenBy
}); });
} }
QueryBuilder<Settings, Settings, QAfterSortBy> thenByNovelFontSize() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelFontSize', Sort.asc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> thenByNovelFontSizeDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelFontSize', Sort.desc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> thenByNovelGridSize() { QueryBuilder<Settings, Settings, QAfterSortBy> thenByNovelGridSize() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelGridSize', Sort.asc); return query.addSortBy(r'novelGridSize', Sort.asc);
@ -10167,6 +10365,18 @@ extension SettingsQuerySortThenBy
}); });
} }
QueryBuilder<Settings, Settings, QAfterSortBy> thenByNovelTextAlign() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelTextAlign', Sort.asc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> thenByNovelTextAlignDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'novelTextAlign', Sort.desc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> QueryBuilder<Settings, Settings, QAfterSortBy>
thenByOnlyIncludePinnedSources() { thenByOnlyIncludePinnedSources() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
@ -10762,6 +10972,12 @@ extension SettingsQueryWhereDistinct
}); });
} }
QueryBuilder<Settings, Settings, QDistinct> distinctByNovelFontSize() {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(r'novelFontSize');
});
}
QueryBuilder<Settings, Settings, QDistinct> distinctByNovelGridSize() { QueryBuilder<Settings, Settings, QDistinct> distinctByNovelGridSize() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(r'novelGridSize'); return query.addDistinctBy(r'novelGridSize');
@ -10810,6 +11026,12 @@ extension SettingsQueryWhereDistinct
}); });
} }
QueryBuilder<Settings, Settings, QDistinct> distinctByNovelTextAlign() {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(r'novelTextAlign');
});
}
QueryBuilder<Settings, Settings, QDistinct> QueryBuilder<Settings, Settings, QDistinct>
distinctByOnlyIncludePinnedSources() { distinctByOnlyIncludePinnedSources() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
@ -11404,6 +11626,12 @@ extension SettingsQueryProperty
}); });
} }
QueryBuilder<Settings, int?, QQueryOperations> novelFontSizeProperty() {
return QueryBuilder.apply(this, (query) {
return query.addPropertyName(r'novelFontSize');
});
}
QueryBuilder<Settings, int?, QQueryOperations> novelGridSizeProperty() { QueryBuilder<Settings, int?, QQueryOperations> novelGridSizeProperty() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
return query.addPropertyName(r'novelGridSize'); return query.addPropertyName(r'novelGridSize');
@ -11452,6 +11680,13 @@ extension SettingsQueryProperty
}); });
} }
QueryBuilder<Settings, NovelTextAlign, QQueryOperations>
novelTextAlignProperty() {
return QueryBuilder.apply(this, (query) {
return query.addPropertyName(r'novelTextAlign');
});
}
QueryBuilder<Settings, bool?, QQueryOperations> QueryBuilder<Settings, bool?, QQueryOperations>
onlyIncludePinnedSourcesProperty() { onlyIncludePinnedSourcesProperty() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {

View file

@ -182,3 +182,33 @@ class HideNovelState extends _$HideNovelState {
() => isar.settings.putSync(settings!..hideNovel = value)); () => isar.settings.putSync(settings!..hideNovel = value));
} }
} }
@riverpod
class NovelFontSizeState extends _$NovelFontSizeState {
@override
int build() {
return isar.settings.getSync(227)!.novelFontSize ?? 14;
}
void set(int value) {
final settings = isar.settings.getSync(227);
state = value;
isar.writeTxnSync(
() => isar.settings.putSync(settings!..novelFontSize = value));
}
}
@riverpod
class NovelTextAlignState extends _$NovelTextAlignState {
@override
NovelTextAlign build() {
return isar.settings.getSync(227)!.novelTextAlign;
}
void set(NovelTextAlign value) {
final settings = isar.settings.getSync(227);
state = value;
isar.writeTxnSync(
() => isar.settings.putSync(settings!..novelTextAlign = value));
}
}

View file

@ -205,5 +205,39 @@ final hideNovelStateProvider =
); );
typedef _$HideNovelState = AutoDisposeNotifier<bool>; typedef _$HideNovelState = AutoDisposeNotifier<bool>;
String _$novelFontSizeStateHash() =>
r'fd104e358203d3f86e14d933518f2dbd067cec13';
/// See also [NovelFontSizeState].
@ProviderFor(NovelFontSizeState)
final novelFontSizeStateProvider =
AutoDisposeNotifierProvider<NovelFontSizeState, int>.internal(
NovelFontSizeState.new,
name: r'novelFontSizeStateProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$novelFontSizeStateHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$NovelFontSizeState = AutoDisposeNotifier<int>;
String _$novelTextAlignStateHash() =>
r'87664160c3962b96b8582a7581cf1e4ebb870363';
/// See also [NovelTextAlignState].
@ProviderFor(NovelTextAlignState)
final novelTextAlignStateProvider =
AutoDisposeNotifierProvider<NovelTextAlignState, NovelTextAlign>.internal(
NovelTextAlignState.new,
name: r'novelTextAlignStateProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$novelTextAlignStateHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$NovelTextAlignState = AutoDisposeNotifier<NovelTextAlign>;
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

View file

@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'dart:math';
import 'package:extended_image/extended_image.dart'; import 'package:extended_image/extended_image.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -71,6 +72,7 @@ class _NovelWebViewState extends ConsumerState<NovelWebView>
bool scrolled = false; bool scrolled = false;
double offset = 0; double offset = 0;
double maxOffset = 0; double maxOffset = 0;
int fontSize = 14;
bool isDesktop = Platform.isMacOS || Platform.isLinux || Platform.isWindows; bool isDesktop = Platform.isMacOS || Platform.isLinux || Platform.isWindows;
void onScroll() { void onScroll() {
@ -106,6 +108,10 @@ class _NovelWebViewState extends ConsumerState<NovelWebView>
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
_scrollController.addListener(onScroll); _scrollController.addListener(onScroll);
final initFontSize = ref.read(novelFontSizeStateProvider);
setState(() {
fontSize = initFontSize;
});
}); });
} }
@ -214,88 +220,94 @@ class _NovelWebViewState extends ConsumerState<NovelWebView>
} }
}); });
return Expanded( return Expanded(
child: SingleChildScrollView( child: Scrollbar(
controller: _scrollController, controller: _scrollController,
physics: const BouncingScrollPhysics(), interactive: true,
child: GestureDetector( child: SingleChildScrollView(
behavior: HitTestBehavior.translucent, controller: _scrollController,
onTap: () { physics: const BouncingScrollPhysics(),
_isViewFunction(); child: GestureDetector(
}, behavior: HitTestBehavior.translucent,
child: Column( onTap: () {
children: [ _isViewFunction();
HtmlWidget( },
htmlContent, child: Column(
customStylesBuilder: (element) { children: [
switch (backgroundColor) { HtmlWidget(
case BackgroundColor.black: htmlContent,
return { customStylesBuilder: (element) {
'background-color': 'black', switch (backgroundColor) {
}; case BackgroundColor.black:
default: return {
return { 'background-color': 'black',
'background-color': '#F0F0F0', };
}; default:
} return {
}, 'background-color': '#F0F0F0',
onTapUrl: (url) { };
context.push("/mangawebview", }
extra: {'url': url, 'title': url}); },
return true; onTapUrl: (url) {
}, context.push("/mangawebview", extra: {
renderMode: RenderMode.column, 'url': url,
textStyle: TextStyle( 'title': url
color: backgroundColor == });
BackgroundColor.white return true;
? Colors.black },
: Colors.white, renderMode: RenderMode.column,
fontSize: 14), textStyle: TextStyle(
), color: backgroundColor ==
Center( BackgroundColor.white
heightFactor: 2, ? Colors.black
child: Row( : Colors.white,
mainAxisAlignment: fontSize: fontSize.toDouble()),
MainAxisAlignment.center,
spacing: 5,
children: [
IconButton(
padding: const EdgeInsets.all(5),
onPressed: () =>
pushReplacementMangaReaderView(
context: context,
chapter: _readerController
.getPrevChapter(),
),
icon: Icon(
size: 32,
Icons.arrow_back,
color: backgroundColor ==
BackgroundColor.white
? Colors.black
: Colors.white,
),
),
IconButton(
padding: const EdgeInsets.all(5),
onPressed: () =>
pushReplacementMangaReaderView(
context: context,
chapter: _readerController
.getNextChapter(),
),
icon: Icon(
size: 32,
Icons.arrow_forward,
color: backgroundColor ==
BackgroundColor.white
? Colors.black
: Colors.white,
),
),
],
), ),
), Center(
], heightFactor: 2,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
spacing: 5,
children: [
IconButton(
padding: const EdgeInsets.all(5),
onPressed: () =>
pushReplacementMangaReaderView(
context: context,
chapter: _readerController
.getPrevChapter(),
),
icon: Icon(
size: 32,
Icons.arrow_back,
color: backgroundColor ==
BackgroundColor.white
? Colors.black
: Colors.white,
),
),
IconButton(
padding: const EdgeInsets.all(5),
onPressed: () =>
pushReplacementMangaReaderView(
context: context,
chapter: _readerController
.getNextChapter(),
),
icon: Icon(
size: 32,
Icons.arrow_forward,
color: backgroundColor ==
BackgroundColor.white
? Colors.black
: Colors.white,
),
),
],
),
),
],
),
), ),
), ),
), ),
@ -310,9 +322,8 @@ class _NovelWebViewState extends ConsumerState<NovelWebView>
)), )),
], ],
), ),
//_gestureRightLeft(),
//_gestureTopBottom(),
_appBar(), _appBar(),
_bottomBar(backgroundColor),
], ],
), ),
), ),
@ -431,6 +442,251 @@ class _NovelWebViewState extends ConsumerState<NovelWebView>
); );
} }
Widget _bottomBar(BackgroundColor backgroundColor) {
if (!_isView && Platform.isIOS) {
return const SizedBox.shrink();
}
bool hasPrevChapter = _readerController.getChapterIndex().$1 + 1 !=
_readerController
.getChaptersLength(_readerController.getChapterIndex().$2);
bool hasNextChapter = _readerController.getChapterIndex().$1 != 0;
final novelTextAlign = ref.watch(novelTextAlignStateProvider);
return Positioned(
bottom: 0,
child: AnimatedContainer(
curve: Curves.ease,
duration: const Duration(milliseconds: 300),
width: context.width(1),
height: (_isView ? 130 : 0),
child: Column(
children: [
Flexible(
child: Transform.scale(
scaleX: 1,
child: Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(
radius: 23,
backgroundColor: _backgroundColor(context),
child: IconButton(
onPressed: hasPrevChapter
? () {
pushReplacementMangaReaderView(
context: context,
chapter:
_readerController.getPrevChapter());
}
: null,
icon: Transform.scale(
scaleX: 1,
child: Icon(Icons.skip_previous_rounded,
color: hasPrevChapter
? Theme.of(context)
.textTheme
.bodyLarge!
.color
: Theme.of(context)
.textTheme
.bodyLarge!
.color!
.withValues(alpha: 0.4)),
)),
),
),
Flexible(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Container(
height: 70,
decoration: BoxDecoration(
color: _backgroundColor(context),
borderRadius: BorderRadius.circular(25)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Transform.scale(
scaleX: 1,
child: SizedBox(
width: 55,
child: Center(
child: IconButton(
onPressed: () {
final newFontSize =
max(4, fontSize - 1);
ref
.read(novelFontSizeStateProvider
.notifier)
.set(newFontSize);
setState(() {
fontSize = newFontSize;
});
},
icon: const Icon(Icons.text_decrease)),
),
),
),
if (_isView)
Flexible(
flex: 14,
child:
Consumer(builder: (context, ref, child) {
final currentFontSize =
ref.watch(novelFontSizeStateProvider);
return SliderTheme(
data: SliderTheme.of(context).copyWith(
overlayShape:
const RoundSliderOverlayShape(
overlayRadius: 5.0),
),
child: Slider(
onChanged: (value) {
ref
.read(novelFontSizeStateProvider
.notifier)
.set(value.toInt());
},
onChangeEnd: (newValue) {
try {
setState(() {
fontSize = newValue.toInt();
});
} catch (_) {}
},
divisions: 36,
value: currentFontSize.toDouble(),
label: "$currentFontSize",
min: 4,
max: 40,
),
);
}),
),
Transform.scale(
scaleX: 1,
child: SizedBox(
width: 55,
child: Center(
child: IconButton(
onPressed: () {
final newFontSize =
min(40, fontSize + 1);
ref
.read(novelFontSizeStateProvider
.notifier)
.set(newFontSize);
setState(() {
fontSize = newFontSize;
});
},
icon: const Icon(Icons.text_increase)),
),
),
),
],
),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(
radius: 23,
backgroundColor: _backgroundColor(context),
child: IconButton(
onPressed: hasNextChapter
? () {
pushReplacementMangaReaderView(
context: context,
chapter: _readerController.getNextChapter(),
);
}
: null,
icon: Transform.scale(
scaleX: 1,
child: Icon(
Icons.skip_next_rounded,
color: hasNextChapter
? Theme.of(context).textTheme.bodyLarge!.color
: Theme.of(context)
.textTheme
.bodyLarge!
.color!
.withValues(alpha: 0.4),
// size: 17,
),
),
),
),
),
],
),
),
),
/*Flexible(
child: Container(
height: 65,
color: _backgroundColor(context),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
PopupMenuButton(
popUpAnimationStyle: popupAnimationStyle,
color: Colors.black,
child: const Icon(
Icons.format_align_center_outlined,
),
onSelected: (value) {
ref
.read(novelTextAlignStateProvider.notifier)
.set(value);
},
itemBuilder: (context) => [
for (var mode in NovelTextAlign.values)
PopupMenuItem(
value: mode,
child: Row(
children: [
Icon(
Icons.check,
color: novelTextAlign == mode
? Colors.white
: Colors.transparent,
),
const SizedBox(
width: 7,
),
Text(
mode.name,
style: const TextStyle(
color: Colors.white,
fontSize: 12,
),
),
],
)),
],
),
IconButton(
onPressed: () {
// _showModalSettings();
},
icon: const Icon(
Icons.settings_rounded,
),
),
],
),
),
),*/
],
),
),
);
}
void _isViewFunction() { void _isViewFunction() {
final fullScreenReader = ref.watch(fullScreenReaderStateProvider); final fullScreenReader = ref.watch(fullScreenReaderStateProvider);
if (mounted) { if (mounted) {
@ -447,84 +703,6 @@ class _NovelWebViewState extends ConsumerState<NovelWebView>
} }
} }
} }
Widget _gestureRightLeft() {
return Consumer(
builder: (context, ref, child) {
return Row(
children: [
/// left region
Expanded(
flex: 2,
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
_isViewFunction();
},
),
),
/// center region
Expanded(
flex: 2,
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
_isViewFunction();
},
),
),
/// right region
Expanded(
flex: 2,
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
_isViewFunction();
},
),
),
],
);
},
);
}
Widget _gestureTopBottom() {
return Consumer(
builder: (context, ref, child) {
return Column(
children: [
/// top region
Expanded(
flex: 2,
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
_isViewFunction();
},
),
),
/// center region
const Expanded(flex: 5, child: SizedBox.shrink()),
/// bottom region
Expanded(
flex: 2,
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
_isViewFunction();
},
),
),
],
);
},
);
}
} }
class UChapDataPreload { class UChapDataPreload {