diff --git a/lib/main.dart b/lib/main.dart index 9e0b476a..d72e2f64 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hive_flutter/hive_flutter.dart'; +import 'package:mangayomi/models/categories.dart'; import 'package:mangayomi/utils/constant.dart'; import 'package:mangayomi/models/manga_history.dart'; import 'package:mangayomi/models/model_manga.dart'; @@ -30,6 +31,7 @@ void main() async { Hive.registerAdapter(TypeSourceAdapter()); Hive.registerAdapter(DownloadModelAdapter()); Hive.registerAdapter(ModelChaptersAdapter()); + Hive.registerAdapter(CategoriesModelAdapter()); await Hive.openBox(HiveConstant.hiveBoxManga); await Hive.openBox(HiveConstant.hiveBoxMangaHistory); await Hive.openBox(HiveConstant.hiveBoxReaderMode); @@ -38,6 +40,7 @@ void main() async { await Hive.openBox(HiveConstant.hiveBoxMangaInfo); await Hive.openBox(HiveConstant.hiveBoxMangaFilter); await Hive.openBox(HiveConstant.hiveBoxAppSettings); + await Hive.openBox(HiveConstant.hiveBoxCategories); runApp(const ProviderScope(child: MyApp())); } diff --git a/lib/models/categories.dart b/lib/models/categories.dart new file mode 100644 index 00000000..ec280e6b --- /dev/null +++ b/lib/models/categories.dart @@ -0,0 +1,15 @@ +import 'package:hive/hive.dart'; +import 'package:mangayomi/models/model_manga.dart'; +part 'categories.g.dart'; + +@HiveType(typeId: 8) +class CategoriesModel extends HiveObject { + @HiveField(0) + final int id; + @HiveField(1) + final String name; + @HiveField(2) + final List listModelManga; + CategoriesModel( + {required this.id, required this.name, required this.listModelManga}); +} diff --git a/lib/models/categories.g.dart b/lib/models/categories.g.dart new file mode 100644 index 00000000..c688acaf --- /dev/null +++ b/lib/models/categories.g.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'categories.dart'; + +// ************************************************************************** +// TypeAdapterGenerator +// ************************************************************************** + +class CategoriesModelAdapter extends TypeAdapter { + @override + final int typeId = 8; + + @override + CategoriesModel read(BinaryReader reader) { + final numOfFields = reader.readByte(); + final fields = { + for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), + }; + return CategoriesModel( + id: fields[0] as int, + name: fields[1] as String, + listModelManga: (fields[2] as List).cast(), + ); + } + + @override + void write(BinaryWriter writer, CategoriesModel obj) { + writer + ..writeByte(3) + ..writeByte(0) + ..write(obj.id) + ..writeByte(1) + ..write(obj.name) + ..writeByte(2) + ..write(obj.listModelManga); + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is CategoriesModelAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/lib/providers/hive_provider.dart b/lib/providers/hive_provider.dart index 50015f93..57562b48 100644 --- a/lib/providers/hive_provider.dart +++ b/lib/providers/hive_provider.dart @@ -1,37 +1,55 @@ -import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:hive_flutter/hive_flutter.dart'; +import 'package:mangayomi/models/categories.dart'; import 'package:mangayomi/utils/constant.dart'; import 'package:mangayomi/models/manga_history.dart'; import 'package:mangayomi/models/model_manga.dart'; import 'package:mangayomi/source/source_model.dart'; import 'package:mangayomi/views/manga/download/download_model.dart'; import 'package:mangayomi/views/manga/reader/providers/reader_controller_provider.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; +part 'hive_provider.g.dart'; -final hiveBoxManga = Provider>((ref) { +@riverpod +Box hiveBoxManga(HiveBoxMangaRef ref) { return Hive.box(HiveConstant.hiveBoxManga); -}); +} -final hiveBoxMangaInfo = Provider((ref) { +@riverpod +Box hiveBoxMangaInfo(HiveBoxMangaInfoRef ref) { return Hive.box(HiveConstant.hiveBoxMangaInfo); -}); +} -final hiveBoxMangaHistory = Provider>((ref) { +@riverpod +Box hiveBoxMangaHistory(HiveBoxMangaHistoryRef ref) { return Hive.box(HiveConstant.hiveBoxMangaHistory); -}); -final hiveBoxReaderMode = Provider>((ref) { +} + +@riverpod +Box hiveBoxReaderMode(HiveBoxReaderModeRef ref) { return Hive.box(HiveConstant.hiveBoxReaderMode); -}); -final hiveBoxMangaFilterProvider = Provider((ref) { +} + +@riverpod +Box hiveBoxMangaFilter(HiveBoxMangaFilterRef ref) { return Hive.box(HiveConstant.hiveBoxMangaFilter); -}); +} -final hiveBoxMangaSourceProvider = Provider>((ref) { +@riverpod +Box hiveBoxMangaSource(HiveBoxMangaSourceRef ref) { return Hive.box(HiveConstant.hiveBoxMangaSource); -}); -final hiveBoxMangaDownloads = Provider>((ref) { - return Hive.box(HiveConstant.hiveBoxDownloads); -}); +} -final hiveBoxSettings = Provider((ref) { +@riverpod +Box hiveBoxMangaDownloads(HiveBoxMangaDownloadsRef ref) { + return Hive.box(HiveConstant.hiveBoxDownloads); +} + +@riverpod +Box hiveBoxSettings(HiveBoxSettingsRef ref) { return Hive.box(HiveConstant.hiveBoxAppSettings); -}); +} + +@riverpod +Box hiveBoxCategories(HiveBoxCategoriesRef ref) { + return Hive.box(HiveConstant.hiveBoxCategories); +} diff --git a/lib/providers/hive_provider.g.dart b/lib/providers/hive_provider.g.dart new file mode 100644 index 00000000..fa6aa8a1 --- /dev/null +++ b/lib/providers/hive_provider.g.dart @@ -0,0 +1,151 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'hive_provider.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +String _$hiveBoxMangaHash() => r'63b8c649d7ac482b84fafa635626249294d4f92d'; + +/// See also [hiveBoxManga]. +@ProviderFor(hiveBoxManga) +final hiveBoxMangaProvider = AutoDisposeProvider>.internal( + hiveBoxManga, + name: r'hiveBoxMangaProvider', + debugGetCreateSourceHash: + const bool.fromEnvironment('dart.vm.product') ? null : _$hiveBoxMangaHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef HiveBoxMangaRef = AutoDisposeProviderRef>; +String _$hiveBoxMangaInfoHash() => r'638c65c996c731a9764acc5911f9b0ec75b60273'; + +/// See also [hiveBoxMangaInfo]. +@ProviderFor(hiveBoxMangaInfo) +final hiveBoxMangaInfoProvider = AutoDisposeProvider>.internal( + hiveBoxMangaInfo, + name: r'hiveBoxMangaInfoProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$hiveBoxMangaInfoHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef HiveBoxMangaInfoRef = AutoDisposeProviderRef>; +String _$hiveBoxMangaHistoryHash() => + r'dd5c7a3cd8bfceb7b577c56f5ef8755914416c1e'; + +/// See also [hiveBoxMangaHistory]. +@ProviderFor(hiveBoxMangaHistory) +final hiveBoxMangaHistoryProvider = + AutoDisposeProvider>.internal( + hiveBoxMangaHistory, + name: r'hiveBoxMangaHistoryProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$hiveBoxMangaHistoryHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef HiveBoxMangaHistoryRef = AutoDisposeProviderRef>; +String _$hiveBoxReaderModeHash() => r'fabc2f9e6b46c1ba0f1965630ff91f0bdccfeb99'; + +/// See also [hiveBoxReaderMode]. +@ProviderFor(hiveBoxReaderMode) +final hiveBoxReaderModeProvider = AutoDisposeProvider>.internal( + hiveBoxReaderMode, + name: r'hiveBoxReaderModeProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$hiveBoxReaderModeHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef HiveBoxReaderModeRef = AutoDisposeProviderRef>; +String _$hiveBoxMangaFilterHash() => + r'fe7604bc1dd46517a81f669fe11a8898d89aca44'; + +/// See also [hiveBoxMangaFilter]. +@ProviderFor(hiveBoxMangaFilter) +final hiveBoxMangaFilterProvider = AutoDisposeProvider>.internal( + hiveBoxMangaFilter, + name: r'hiveBoxMangaFilterProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$hiveBoxMangaFilterHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef HiveBoxMangaFilterRef = AutoDisposeProviderRef>; +String _$hiveBoxMangaSourceHash() => + r'9620aa7034d4efb0cb5a06276db8e308e4b22c83'; + +/// See also [hiveBoxMangaSource]. +@ProviderFor(hiveBoxMangaSource) +final hiveBoxMangaSourceProvider = + AutoDisposeProvider>.internal( + hiveBoxMangaSource, + name: r'hiveBoxMangaSourceProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$hiveBoxMangaSourceHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef HiveBoxMangaSourceRef = AutoDisposeProviderRef>; +String _$hiveBoxMangaDownloadsHash() => + r'8c01ad805facb717b531f6f21b87f35f4fd58a6b'; + +/// See also [hiveBoxMangaDownloads]. +@ProviderFor(hiveBoxMangaDownloads) +final hiveBoxMangaDownloadsProvider = + AutoDisposeProvider>.internal( + hiveBoxMangaDownloads, + name: r'hiveBoxMangaDownloadsProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$hiveBoxMangaDownloadsHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef HiveBoxMangaDownloadsRef = AutoDisposeProviderRef>; +String _$hiveBoxSettingsHash() => r'3e948a0ae8fc23d691aeb3e39032007b07f33290'; + +/// See also [hiveBoxSettings]. +@ProviderFor(hiveBoxSettings) +final hiveBoxSettingsProvider = AutoDisposeProvider>.internal( + hiveBoxSettings, + name: r'hiveBoxSettingsProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$hiveBoxSettingsHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef HiveBoxSettingsRef = AutoDisposeProviderRef>; +String _$hiveBoxCategoriesHash() => r'615bfbed369d04371e7403052fea307f001d61fd'; + +/// See also [hiveBoxCategories]. +@ProviderFor(hiveBoxCategories) +final hiveBoxCategoriesProvider = + AutoDisposeProvider>.internal( + hiveBoxCategories, + name: r'hiveBoxCategoriesProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$hiveBoxCategoriesHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef HiveBoxCategoriesRef = AutoDisposeProviderRef>; +// ignore_for_file: unnecessary_raw_strings, subtype_of_sealed_class, invalid_use_of_internal_member, do_not_use_environment, prefer_const_constructors, public_member_api_docs, avoid_private_typedef_functions diff --git a/lib/router/router.dart b/lib/router/router.dart index 16d7a5e8..eb7abad7 100644 --- a/lib/router/router.dart +++ b/lib/router/router.dart @@ -19,6 +19,7 @@ import 'package:mangayomi/views/more/about_screen.dart'; import 'package:mangayomi/views/more/download_queue/download_queue_screen.dart'; import 'package:mangayomi/views/more/more_screen.dart'; import 'package:mangayomi/views/more/settings/appearance/appearance_screen.dart'; +import 'package:mangayomi/views/more/settings/categoties/categories_screen.dart'; import 'package:mangayomi/views/more/settings/settings_screen.dart'; import 'package:mangayomi/views/updates/updates_screen.dart'; @@ -267,6 +268,19 @@ class AsyncRouterNotifier extends ChangeNotifier { ); }, ), + GoRoute( + path: "/categories", + name: "categories", + builder: (context, state) { + return const CategoriesScreen(); + }, + pageBuilder: (context, state) { + return CustomTransition( + key: state.pageKey, + child: const CategoriesScreen(), + ); + }, + ), ]; } diff --git a/lib/services/get_manga_chapter_url.dart b/lib/services/get_manga_chapter_url.dart index bbdd69b5..4ebc197c 100644 --- a/lib/services/get_manga_chapter_url.dart +++ b/lib/services/get_manga_chapter_url.dart @@ -76,7 +76,7 @@ Future getMangaChapterUrl( final decoded = utf8.decode(base64.decode(unscrambledData)); final data = jsonDecode(decoded); urll = data["imagesLink"].map((it) => it).toList(); - ref.watch(hiveBoxMangaInfo).put( + ref.watch(hiveBoxMangaInfoProvider).put( "${modelManga.lang}-${modelManga.source}/${modelManga.name}/${modelManga.chapters![index].name}-pageurl", urll); } catch (_) {} @@ -86,7 +86,7 @@ Future getMangaChapterUrl( List isLocaleList = []; String source = modelManga.source!.toLowerCase(); - List pagesUrl = ref.watch(hiveBoxMangaInfo).get( + List pagesUrl = ref.watch(hiveBoxMangaInfoProvider).get( "${modelManga.lang}-${modelManga.source}/${modelManga.name}/${modelManga.chapters![index].name}-pageurl", defaultValue: []); final incognitoMode = ref.watch(incognitoModeStateProvider); @@ -113,7 +113,7 @@ Future getMangaChapterUrl( urll.add(url.url); } if (!incognitoMode) { - ref.watch(hiveBoxMangaInfo).put( + ref.watch(hiveBoxMangaInfoProvider).put( "${modelManga.lang}-${modelManga.source}/${modelManga.name}/${modelManga.chapters![index].name}-pageurl", urll); } @@ -165,7 +165,7 @@ Future getMangaChapterUrl( } } if (!incognitoMode) { - ref.watch(hiveBoxMangaInfo).put( + ref.watch(hiveBoxMangaInfoProvider).put( "${modelManga.lang}-${modelManga.source}/${modelManga.name}/${modelManga.chapters![index].name}-pageurl", urll); } @@ -198,7 +198,7 @@ Future getMangaChapterUrl( 'https://cdn.mangakawaii.pics/uploads/manga/$mangaSlug/chapters_fr/$chapterSlug/$tt'); } if (!incognitoMode) { - ref.watch(hiveBoxMangaInfo).put( + ref.watch(hiveBoxMangaInfoProvider).put( "${modelManga.lang}-${modelManga.source}/${modelManga.name}/${modelManga.chapters![index].name}-pageurl", urll); } @@ -234,7 +234,7 @@ Future getMangaChapterUrl( }).toList(); // log(message) if (!incognitoMode) { - ref.watch(hiveBoxMangaInfo).put( + ref.watch(hiveBoxMangaInfoProvider).put( "${modelManga.lang}-${modelManga.source}/${modelManga.name}/${modelManga.chapters![index].name}-pageurl", urll); } @@ -350,7 +350,7 @@ Future getMangaChapterUrl( flutterJs.dispose(); if (!incognitoMode) { - ref.watch(hiveBoxMangaInfo).put( + ref.watch(hiveBoxMangaInfoProvider).put( "${modelManga.lang}-${modelManga.source}/${modelManga.name}/${modelManga.chapters![index].name}-pageurl", urll); } diff --git a/lib/utils/constant.dart b/lib/utils/constant.dart index e8b10cd2..3915b7a7 100644 --- a/lib/utils/constant.dart +++ b/lib/utils/constant.dart @@ -8,6 +8,7 @@ class HiveConstant { static String get hiveBoxDownloads => "_manga_box_downloads_"; static String get hiveBoxReaderSettings => "_reader_box_settings_"; static String get hiveBoxReaderMode => "_readerMode_box_settings_"; + static String get hiveBoxCategories => "_manga_box_categorie_"; } const defaultUserAgent = diff --git a/lib/views/history/history_screen.dart b/lib/views/history/history_screen.dart index 3a1f85bf..a6cfadf3 100644 --- a/lib/views/history/history_screen.dart +++ b/lib/views/history/history_screen.dart @@ -93,7 +93,7 @@ class _HistoryScreenState extends ConsumerState { ), TextButton( onPressed: () { - ref.watch(hiveBoxMangaHistory).clear(); + ref.watch(hiveBoxMangaHistoryProvider).clear(); Navigator.pop(context); }, child: const Text("Ok")), @@ -110,7 +110,7 @@ class _HistoryScreenState extends ConsumerState { body: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: ValueListenableBuilder>( - valueListenable: ref.watch(hiveBoxMangaHistory).listenable(), + valueListenable: ref.watch(hiveBoxMangaHistoryProvider).listenable(), builder: (context, value, child) { final entries = value.values.toList(); entriesData = value.values.toList(); @@ -156,7 +156,7 @@ class _HistoryScreenState extends ConsumerState { Flexible( child: ValueListenableBuilder( valueListenable: - ref.watch(hiveBoxMangaInfo).listenable(), + ref.watch(hiveBoxMangaInfoProvider).listenable(), builder: (context, value, child) { final values = value.get( "${element.modelManga.lang}-${element.modelManga.source}/${element.modelManga.name}-chapter_index", @@ -254,7 +254,7 @@ class _HistoryScreenState extends ConsumerState { onPressed: () { ref .watch( - hiveBoxMangaHistory) + hiveBoxMangaHistoryProvider) .delete( '${element.modelManga.lang}-${element.modelManga.link}'); Navigator.pop( diff --git a/lib/views/library/library_screen.dart b/lib/views/library/library_screen.dart index 679d9545..7e490c0f 100644 --- a/lib/views/library/library_screen.dart +++ b/lib/views/library/library_screen.dart @@ -93,7 +93,7 @@ class _LibraryScreenState extends ConsumerState ], ), body: ValueListenableBuilder>( - valueListenable: ref.watch(hiveBoxManga).listenable(), + valueListenable: ref.watch(hiveBoxMangaProvider).listenable(), builder: (context, value, child) { entries = value.values.where((element) => element.favorite).toList(); final data = diff --git a/lib/views/library/providers/library_state_provider.dart b/lib/views/library/providers/library_state_provider.dart index 01f603a0..e30fd267 100644 --- a/lib/views/library/providers/library_state_provider.dart +++ b/lib/views/library/providers/library_state_provider.dart @@ -8,13 +8,13 @@ class LibraryReverseListState extends _$LibraryReverseListState { @override bool build() { return ref - .watch(hiveBoxSettings) + .watch(hiveBoxSettingsProvider) .get('libraryReverseList', defaultValue: false)!; } void setLibraryReverseList(bool value) { state = value; - ref.watch(hiveBoxSettings).put('libraryReverseList', value); + ref.watch(hiveBoxSettingsProvider).put('libraryReverseList', value); } } @@ -23,7 +23,7 @@ class LibraryDisplayTypeState extends _$LibraryDisplayTypeState { @override String build() { return ref - .watch(hiveBoxSettings) + .watch(hiveBoxSettingsProvider) .get('displayType', defaultValue: DisplayType.coverOnlyGrid.name)!; } @@ -49,7 +49,7 @@ class LibraryDisplayTypeState extends _$LibraryDisplayTypeState { void setLibraryDisplayType(DisplayType displayType) { state = displayType.name; - ref.watch(hiveBoxSettings).put('displayType', displayType.name); + ref.watch(hiveBoxSettingsProvider).put('displayType', displayType.name); } } @@ -70,12 +70,12 @@ class MangaFilterDownloadedState extends _$MangaFilterDownloadedState { int getType() { return ref - .watch(hiveBoxSettings) + .watch(hiveBoxSettingsProvider) .get("filterMangaDownload", defaultValue: 0); } void setType(int type) { - ref.watch(hiveBoxSettings).put("filterMangaDownload", type); + ref.watch(hiveBoxSettingsProvider).put("filterMangaDownload", type); state = type; } @@ -85,7 +85,7 @@ class MangaFilterDownloadedState extends _$MangaFilterDownloadedState { List list = []; for (var chap in element.chapters!) { final modelChapDownload = ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .get(chap.name, defaultValue: null); if (modelChapDownload != null && modelChapDownload.isDownload == true) { @@ -101,7 +101,7 @@ class MangaFilterDownloadedState extends _$MangaFilterDownloadedState { List list = []; for (var chap in element.chapters!) { final modelChapDownload = ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .get(chap.name, defaultValue: null); if (modelChapDownload == null || modelChapDownload.isDownload == false) { @@ -122,7 +122,7 @@ class MangaFilterDownloadedState extends _$MangaFilterDownloadedState { List list = []; for (var chap in element.chapters!) { final modelChapDownload = ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .get(chap.name, defaultValue: null); if (modelChapDownload != null && modelChapDownload.isDownload == true) { @@ -138,7 +138,7 @@ class MangaFilterDownloadedState extends _$MangaFilterDownloadedState { List list = []; for (var chap in element.chapters!) { final modelChapDownload = ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .get(chap.name, defaultValue: null); if (modelChapDownload == null || modelChapDownload.isDownload == false) { @@ -165,11 +165,11 @@ class MangaFilterUnreadState extends _$MangaFilterUnreadState { } int getType() { - return ref.watch(hiveBoxSettings).get("filterMangaUnread", defaultValue: 0); + return ref.watch(hiveBoxSettingsProvider).get("filterMangaUnread", defaultValue: 0); } void setType(int type) { - ref.watch(hiveBoxSettings).put("filterMangaUnread", type); + ref.watch(hiveBoxSettingsProvider).put("filterMangaUnread", type); state = type; } @@ -242,11 +242,11 @@ class MangaFilterStartedState extends _$MangaFilterStartedState { } int getType() { - return ref.watch(hiveBoxSettings).get("filterMangaStated", defaultValue: 0); + return ref.watch(hiveBoxSettingsProvider).get("filterMangaStated", defaultValue: 0); } void setType(int type) { - ref.watch(hiveBoxSettings).put("filterMangaStated", type); + ref.watch(hiveBoxSettingsProvider).put("filterMangaStated", type); state = type; } @@ -320,12 +320,12 @@ class MangaFilterBookmarkedState extends _$MangaFilterBookmarkedState { int getType() { return ref - .watch(hiveBoxSettings) + .watch(hiveBoxSettingsProvider) .get("filterMangaBookMarked", defaultValue: 0); } void setType(int type) { - ref.watch(hiveBoxSettings).put("filterMangaBookMarked", type); + ref.watch(hiveBoxSettingsProvider).put("filterMangaBookMarked", type); state = type; } diff --git a/lib/views/manga/detail/manga_details_view.dart b/lib/views/manga/detail/manga_details_view.dart index f9f2c38f..c4dcd190 100644 --- a/lib/views/manga/detail/manga_details_view.dart +++ b/lib/views/manga/detail/manga_details_view.dart @@ -52,13 +52,13 @@ class _MangaDetailsViewState extends ConsumerState { @override Widget build(BuildContext context) { - final manga = ref.watch(hiveBoxManga); + final manga = ref.watch(hiveBoxMangaProvider); return Scaffold( floatingActionButton: ref.watch(isLongPressedStateProvider) == true ? null : widget.modelManga.chapters!.isNotEmpty ? ValueListenableBuilder( - valueListenable: ref.watch(hiveBoxMangaInfo).listenable(), + valueListenable: ref.watch(hiveBoxMangaInfoProvider).listenable(), builder: (context, value, child) { final entries = value.get( "${widget.modelManga.lang}-${widget.modelManga.source}/${widget.modelManga.name}-chapter_index", @@ -207,7 +207,7 @@ class _MangaDetailsViewState extends ConsumerState { ], ), action: ValueListenableBuilder>( - valueListenable: ref.watch(hiveBoxManga).listenable(), + valueListenable: ref.watch(hiveBoxMangaProvider).listenable(), builder: (context, value, child) { final entries = value.values .where((element) => diff --git a/lib/views/manga/detail/manga_reader_detail.dart b/lib/views/manga/detail/manga_reader_detail.dart index 13f98935..9e4a9a2d 100644 --- a/lib/views/manga/detail/manga_reader_detail.dart +++ b/lib/views/manga/detail/manga_reader_detail.dart @@ -77,7 +77,7 @@ class _MangaReaderDetailState extends ConsumerState { chapters: chapters, category: widget.modelManga.category, lastRead: widget.modelManga.lastRead); - ref.watch(hiveBoxManga).put( + ref.watch(hiveBoxMangaProvider).put( '${widget.modelManga.lang}-${widget.modelManga.link}', model); } @@ -97,7 +97,7 @@ class _MangaReaderDetailState extends ConsumerState { } }, child: ValueListenableBuilder>( - valueListenable: ref.watch(hiveBoxManga).listenable(), + valueListenable: ref.watch(hiveBoxMangaProvider).listenable(), builder: (context, value, child) { final entries = value.values .where((element) => diff --git a/lib/views/manga/detail/providers/state_providers.dart b/lib/views/manga/detail/providers/state_providers.dart index 52296b9d..69e2e199 100644 --- a/lib/views/manga/detail/providers/state_providers.dart +++ b/lib/views/manga/detail/providers/state_providers.dart @@ -95,14 +95,14 @@ class IsExtendedState extends _$IsExtendedState { class ReverseMangaState extends _$ReverseMangaState { @override bool build({required ModelManga modelManga}) { - return ref.watch(hiveBoxSettings).get( + return ref.watch(hiveBoxSettingsProvider).get( "${modelManga.source}/${modelManga.name}-reverseChapter", defaultValue: false); } void update(bool value) { ref - .watch(hiveBoxSettings) + .watch(hiveBoxSettingsProvider) .put("${modelManga.source}/${modelManga.name}-reverseChapter", value); state = value; } @@ -117,13 +117,13 @@ class ChapterFilterDownloadedState extends _$ChapterFilterDownloadedState { } int getType() { - return ref.watch(hiveBoxSettings).get( + return ref.watch(hiveBoxSettingsProvider).get( "${modelManga.source}/${modelManga.name}-filterChapterDownload", defaultValue: 0); } void setType(int type) { - ref.watch(hiveBoxSettings).put( + ref.watch(hiveBoxSettingsProvider).put( "${modelManga.source}/${modelManga.name}-filterChapterDownload", type); state = type; } @@ -134,7 +134,7 @@ class ChapterFilterDownloadedState extends _$ChapterFilterDownloadedState { final chapters = modelManga.chapters; for (var i = 0; i < chapters!.length; i++) { final modelChapDownload = ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .get(chapters[i].name, defaultValue: null); if (modelChapDownload != null && modelChapDownload.isDownload == true) { chap.add(ModelChapters( @@ -156,7 +156,7 @@ class ChapterFilterDownloadedState extends _$ChapterFilterDownloadedState { final chapters = modelManga.chapters; for (var i = 0; i < chapters!.length; i++) { final modelChapDownload = ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .get(chapters[i].name, defaultValue: null); if (!(modelChapDownload != null && modelChapDownload.isDownload == true)) { @@ -185,7 +185,7 @@ class ChapterFilterDownloadedState extends _$ChapterFilterDownloadedState { final chapters = modelManga.chapters; for (var i = 0; i < chapters!.length; i++) { final modelChapDownload = ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .get(chapters[i].name, defaultValue: null); if (modelChapDownload != null && modelChapDownload.isDownload == true) { chap.add(ModelChapters( @@ -207,7 +207,7 @@ class ChapterFilterDownloadedState extends _$ChapterFilterDownloadedState { final chapters = modelManga.chapters; for (var i = 0; i < chapters!.length; i++) { final modelChapDownload = ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .get(chapters[i].name, defaultValue: null); if (!(modelChapDownload != null && modelChapDownload.isDownload == true)) { @@ -241,13 +241,13 @@ class ChapterFilterUnreadState extends _$ChapterFilterUnreadState { } int getType() { - return ref.watch(hiveBoxSettings).get( + return ref.watch(hiveBoxSettingsProvider).get( "${modelManga.source}/${modelManga.name}-filterChapterUnread", defaultValue: 0); } void setType(int type) { - ref.watch(hiveBoxSettings).put( + ref.watch(hiveBoxSettingsProvider).put( "${modelManga.source}/${modelManga.name}-filterChapterUnread", type); state = type; } @@ -351,13 +351,13 @@ class ChapterFilterBookmarkedState extends _$ChapterFilterBookmarkedState { } int getType() { - return ref.watch(hiveBoxSettings).get( + return ref.watch(hiveBoxSettingsProvider).get( "${modelManga.source}/${modelManga.name}-filterChapterBookMark", defaultValue: 0); } void setType(int type) { - ref.watch(hiveBoxSettings).put( + ref.watch(hiveBoxSettingsProvider).put( "${modelManga.source}/${modelManga.name}-filterChapterBookMark", type); state = type; } @@ -521,7 +521,7 @@ class ChapterSetIsBookmarkState extends _$ChapterSetIsBookmarkState { List chap = []; for (var i = 0; i < modelManga.chapters!.length; i++) { final entries = ref - .watch(hiveBoxManga) + .watch(hiveBoxMangaProvider) .values .where((element) => '${element.lang}-${element.link}' == @@ -544,7 +544,7 @@ class ChapterSetIsBookmarkState extends _$ChapterSetIsBookmarkState { final model = modelMangaWithNewChapValue(modelManga: modelManga, chapters: chap); ref - .watch(hiveBoxManga) + .watch(hiveBoxMangaProvider) .put('${modelManga.lang}-${modelManga.link}', model); } } @@ -560,7 +560,7 @@ class ChapterSetIsReadState extends _$ChapterSetIsReadState { List chap = []; for (var i = 0; i < modelManga.chapters!.length; i++) { final entries = ref - .watch(hiveBoxManga) + .watch(hiveBoxMangaProvider) .values .where((element) => '${element.lang}-${element.link}' == @@ -584,7 +584,7 @@ class ChapterSetIsReadState extends _$ChapterSetIsReadState { final model = modelMangaWithNewChapValue(modelManga: modelManga, chapters: chap); ref - .watch(hiveBoxManga) + .watch(hiveBoxMangaProvider) .put('${modelManga.lang}-${modelManga.link}', model); } } @@ -606,7 +606,7 @@ class ChapterSetDownloadState extends _$ChapterSetDownloadState { } for (var idx in indexList) { final entries = ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .values .where((element) => element.modelManga.chapters![element.index].name == diff --git a/lib/views/manga/detail/providers/state_providers.g.dart b/lib/views/manga/detail/providers/state_providers.g.dart index bdc7a959..49343979 100644 --- a/lib/views/manga/detail/providers/state_providers.g.dart +++ b/lib/views/manga/detail/providers/state_providers.g.dart @@ -687,7 +687,7 @@ class ChapterSetIsBookmarkStateProvider extends AutoDisposeNotifierProviderImpl< } String _$chapterSetIsReadStateHash() => - r'432210665b22f1ff141d906135a381f88f3ccec5'; + r'9435f9d17d5d1fdcfab0279e93d964bd2e4d1fbb'; abstract class _$ChapterSetIsReadState extends BuildlessAutoDisposeNotifier { @@ -786,7 +786,7 @@ class ChapterSetIsReadStateProvider } String _$chapterSetDownloadStateHash() => - r'88cb112fa193aab93e07cd8dca7d7bc54337cb3a'; + r'9c27161d2eedd2e8d55281d9f5640e4459926d6f'; abstract class _$ChapterSetDownloadState extends BuildlessAutoDisposeNotifier { diff --git a/lib/views/manga/download/download_page_widget.dart b/lib/views/manga/download/download_page_widget.dart index 42740e75..eea5be9f 100644 --- a/lib/views/manga/download/download_page_widget.dart +++ b/lib/views/manga/download/download_page_widget.dart @@ -57,11 +57,11 @@ class _ChapterPageDownloadState extends ConsumerState try { path!.deleteSync(recursive: true); - ref.watch(hiveBoxMangaDownloads).delete( + ref.watch(hiveBoxMangaDownloadsProvider).delete( widget.modelManga.chapters![widget.index].name!, ); } catch (e) { - ref.watch(hiveBoxMangaDownloads).delete( + ref.watch(hiveBoxMangaDownloadsProvider).delete( widget.modelManga.chapters![widget.index].name!, ); } @@ -77,7 +77,7 @@ class _ChapterPageDownloadState extends ConsumerState child: Padding( padding: const EdgeInsets.symmetric(vertical: 3), child: ValueListenableBuilder>( - valueListenable: ref.watch(hiveBoxMangaDownloads).listenable(), + valueListenable: ref.watch(hiveBoxMangaDownloadsProvider).listenable(), builder: (context, val, child) { final entries = val.values .where((element) => @@ -129,7 +129,7 @@ class _ChapterPageDownloadState extends ConsumerState .then((value) async { await Future.delayed( const Duration(seconds: 1)); - ref.watch(hiveBoxMangaDownloads).delete( + ref.watch(hiveBoxMangaDownloadsProvider).delete( widget.modelManga .chapters![widget.index].name, ); @@ -206,7 +206,7 @@ class _ChapterPageDownloadState extends ConsumerState .then((value) async { await Future.delayed( const Duration(seconds: 1)); - ref.watch(hiveBoxMangaDownloads).delete( + ref.watch(hiveBoxMangaDownloadsProvider).delete( widget.modelManga .chapters![widget.index].name, ); @@ -245,7 +245,7 @@ class _ChapterPageDownloadState extends ConsumerState ), onSelected: (value) { if (value.toString() == 'Retry') { - ref.watch(hiveBoxMangaDownloads).delete( + ref.watch(hiveBoxMangaDownloadsProvider).delete( widget.modelManga .chapters![widget.index].name, ); @@ -280,7 +280,7 @@ class _ChapterPageDownloadState extends ConsumerState .cancelTasksWithIds(taskIds) .then((value) async { await Future.delayed(const Duration(seconds: 1)); - ref.watch(hiveBoxMangaDownloads).delete( + ref.watch(hiveBoxMangaDownloadsProvider).delete( widget .modelManga.chapters![widget.index].name!, ); diff --git a/lib/views/manga/download/providers/download_provider.dart b/lib/views/manga/download/providers/download_provider.dart index 1b34c171..b18a9cff 100644 --- a/lib/views/manga/download/providers/download_provider.dart +++ b/lib/views/manga/download/providers/download_provider.dart @@ -133,7 +133,7 @@ Future> downloadChapter(DownloadChapterRef ref, isStartDownload: false); ref - .watch(hiveBoxMangaDownloads) + .watch(hiveBoxMangaDownloadsProvider) .put(modelManga.chapters![index].name!, model); } else { await FileDownloader().downloadBatch( diff --git a/lib/views/manga/reader/manga_reader_view.dart b/lib/views/manga/reader/manga_reader_view.dart index 1c4cca51..e3321906 100644 --- a/lib/views/manga/reader/manga_reader_view.dart +++ b/lib/views/manga/reader/manga_reader_view.dart @@ -516,7 +516,11 @@ class _MangaChapterPageGalleryState .getPageLength(widget.url) - 1, 1), - value: _currentIndex.toDouble(), + value: min( + _currentIndex.toDouble(), + widget.readerController + .getPageLength(widget.url) + .toDouble()), min: 0, max: (widget.readerController .getPageLength(widget.url) - diff --git a/lib/views/manga/reader/providers/reader_controller_provider.dart b/lib/views/manga/reader/providers/reader_controller_provider.dart index ca2172f8..9710a3e2 100644 --- a/lib/views/manga/reader/providers/reader_controller_provider.dart +++ b/lib/views/manga/reader/providers/reader_controller_provider.dart @@ -28,7 +28,7 @@ class CurrentIndex extends _$CurrentIndex { final modelManga = mangaReaderModel.modelManga; final incognitoMode = ref.watch(incognitoModeStateProvider); if (!incognitoMode) { - return ref.watch(hiveBoxMangaInfo).get( + return ref.watch(hiveBoxMangaInfoProvider).get( "${modelManga.lang}-${modelManga.source}/${modelManga.name}/${modelManga.chapters![mangaReaderModel.index].name}-page_index", defaultValue: 0); } @@ -50,14 +50,14 @@ class ReaderController extends _$ReaderController { } ReaderMode getReaderMode() { - return ref.watch(hiveBoxReaderMode).get( + return ref.watch(hiveBoxReaderModeProvider).get( "${getSourceName()}/${getMangaName()}-singleMangaReaderModeValue", defaultValue: null) != null - ? ref.watch(hiveBoxReaderMode).get( + ? ref.watch(hiveBoxReaderModeProvider).get( "${getSourceName()}/${getMangaName()}-singleMangaReaderModeValue", )! - : ref.watch(hiveBoxReaderMode).get("globalMangaReaderModeValue", + : ref.watch(hiveBoxReaderModeProvider).get("globalMangaReaderModeValue", defaultValue: ReaderMode.vertical)!; } @@ -74,7 +74,7 @@ class ReaderController extends _$ReaderController { } void setReaderMode(ReaderMode newReaderMode) { - ref.watch(hiveBoxReaderMode).put( + ref.watch(hiveBoxReaderModeProvider).put( "${getSourceName()}/${getMangaName()}-singleMangaReaderModeValue", newReaderMode); } @@ -83,7 +83,7 @@ class ReaderController extends _$ReaderController { final incognitoMode = ref.watch(incognitoModeStateProvider); if (!incognitoMode) { ref - .watch(hiveBoxMangaInfo) + .watch(hiveBoxMangaInfoProvider) .put("${getSourceName()}/${getMangaName()}-showPagesNumber", value); } } @@ -91,7 +91,7 @@ class ReaderController extends _$ReaderController { bool getShowPageNumber() { final incognitoMode = ref.watch(incognitoModeStateProvider); if (!incognitoMode) { - return ref.watch(hiveBoxMangaInfo).get( + return ref.watch(hiveBoxMangaInfoProvider).get( "${getSourceName()}/${getMangaName()}-showPagesNumber", defaultValue: true); } @@ -101,7 +101,7 @@ class ReaderController extends _$ReaderController { void setMangaHistoryUpdate() { final incognitoMode = ref.watch(incognitoModeStateProvider); if (!incognitoMode) { - ref.watch(hiveBoxMangaHistory).put( + ref.watch(hiveBoxMangaHistoryProvider).put( '${getModelManga().lang}-${getModelManga().link}', MangaHistoryModel( date: DateTime.now().toString(), modelManga: getModelManga())); @@ -141,7 +141,7 @@ class ReaderController extends _$ReaderController { category: getModelManga().category, lastRead: getModelManga().lastRead); ref - .watch(hiveBoxManga) + .watch(hiveBoxMangaProvider) .put('${getModelManga().lang}-${getModelManga().link}', model); } } @@ -180,14 +180,14 @@ class ReaderController extends _$ReaderController { category: getModelManga().category, lastRead: getModelManga().lastRead); ref - .watch(hiveBoxManga) + .watch(hiveBoxMangaProvider) .put('${getModelManga().lang}-${getModelManga().link}', model); } } bool getChapterBookmarked() { return ref - .watch(hiveBoxManga) + .watch(hiveBoxMangaProvider) .get('${getModelManga().lang}-${getModelManga().link}', defaultValue: getModelManga())! .chapters![getChapterIndex()] @@ -201,7 +201,7 @@ class ReaderController extends _$ReaderController { void setChapterIndex() { final incognitoMode = ref.watch(incognitoModeStateProvider); if (!incognitoMode) { - ref.watch(hiveBoxMangaInfo).put( + ref.watch(hiveBoxMangaInfoProvider).put( "${getSourceName()}/${getMangaName()}-chapter_index", mangaReaderModel.index.toString()); } @@ -210,7 +210,7 @@ class ReaderController extends _$ReaderController { int getPageIndex() { final incognitoMode = ref.watch(incognitoModeStateProvider); if (!incognitoMode) { - return ref.watch(hiveBoxMangaInfo).get( + return ref.watch(hiveBoxMangaInfoProvider).get( "${getSourceName()}/${getMangaName()}/${getChapterTitle()}-page_index", defaultValue: 0); } @@ -220,7 +220,7 @@ class ReaderController extends _$ReaderController { int getPageLength(List incognitoPageLength) { final incognitoMode = ref.watch(incognitoModeStateProvider); if (!incognitoMode) { - List page = ref.watch(hiveBoxMangaInfo).get( + List page = ref.watch(hiveBoxMangaInfoProvider).get( "${getSourceName()}/${getMangaName()}/${getChapterTitle()}-pageurl", ); return page.length; @@ -231,7 +231,7 @@ class ReaderController extends _$ReaderController { void setPageIndex(int newIndex) { final incognitoMode = ref.watch(incognitoModeStateProvider); if (!incognitoMode) { - ref.watch(hiveBoxMangaInfo).put( + ref.watch(hiveBoxMangaInfoProvider).put( "${getSourceName()}/${getMangaName()}/${getChapterTitle()}-page_index", newIndex); } diff --git a/lib/views/more/download_queue/download_queue_screen.dart b/lib/views/more/download_queue/download_queue_screen.dart index ecc89abb..21225bc6 100644 --- a/lib/views/more/download_queue/download_queue_screen.dart +++ b/lib/views/more/download_queue/download_queue_screen.dart @@ -12,7 +12,7 @@ class DownloadQueueScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return ValueListenableBuilder>( - valueListenable: ref.watch(hiveBoxMangaDownloads).listenable(), + valueListenable: ref.watch(hiveBoxMangaDownloadsProvider).listenable(), builder: (context, val, child) { final entries = val.values .where( @@ -117,7 +117,7 @@ class DownloadQueueScreen extends ConsumerWidget { .then((value) async { await Future.delayed( const Duration(seconds: 1)); - ref.watch(hiveBoxMangaDownloads).delete( + ref.watch(hiveBoxMangaDownloadsProvider).delete( element.modelManga .chapters![element.index].name, ); diff --git a/lib/views/more/more_screen.dart b/lib/views/more/more_screen.dart index 52016abf..cee80139 100644 --- a/lib/views/more/more_screen.dart +++ b/lib/views/more/more_screen.dart @@ -39,7 +39,7 @@ class MoreScreen extends StatelessWidget { ), ListTileWidget( onTap: () { - context.push('/settings'); + context.push('/categories'); }, icon: Icons.label_rounded, title: 'Categories', diff --git a/lib/views/more/settings/appearance/providers/blend_level_state_provider.dart b/lib/views/more/settings/appearance/providers/blend_level_state_provider.dart index 1b247b85..03d1d5e7 100644 --- a/lib/views/more/settings/appearance/providers/blend_level_state_provider.dart +++ b/lib/views/more/settings/appearance/providers/blend_level_state_provider.dart @@ -6,11 +6,11 @@ part 'blend_level_state_provider.g.dart'; class BlendLevelState extends _$BlendLevelState { @override double build() { - return ref.watch(hiveBoxSettings).get('blendLevel', defaultValue: 10.0)!; + return ref.watch(hiveBoxSettingsProvider).get('blendLevel', defaultValue: 10.0)!; } void setBlendLevel(double blendLevelValue) { state = blendLevelValue; - ref.watch(hiveBoxSettings).put('blendLevel', state); + ref.watch(hiveBoxSettingsProvider).put('blendLevel', state); } } diff --git a/lib/views/more/settings/appearance/providers/flex_scheme_color_state_provider.dart b/lib/views/more/settings/appearance/providers/flex_scheme_color_state_provider.dart index 8cc78cfd..bafa6051 100644 --- a/lib/views/more/settings/appearance/providers/flex_scheme_color_state_provider.dart +++ b/lib/views/more/settings/appearance/providers/flex_scheme_color_state_provider.dart @@ -11,19 +11,19 @@ class FlexSchemeColorState extends _$FlexSchemeColorState { return ref.read(themeModeStateProvider) ? ThemeAA .schemes[ref - .watch(hiveBoxSettings) + .watch(hiveBoxSettingsProvider) .get('FlexColorIndex', defaultValue: 2)] .light : ThemeAA .schemes[ref - .watch(hiveBoxSettings) + .watch(hiveBoxSettingsProvider) .get('FlexColorIndex', defaultValue: 2)] .dark; } void setTheme(FlexSchemeColor color, int index) { state = color; - ref.watch(hiveBoxSettings).put('FlexColorIndex', index); + ref.watch(hiveBoxSettingsProvider).put('FlexColorIndex', index); } } diff --git a/lib/views/more/settings/appearance/providers/theme_mode_state_provider.dart b/lib/views/more/settings/appearance/providers/theme_mode_state_provider.dart index 19c3d809..4e9aa7b1 100644 --- a/lib/views/more/settings/appearance/providers/theme_mode_state_provider.dart +++ b/lib/views/more/settings/appearance/providers/theme_mode_state_provider.dart @@ -7,16 +7,16 @@ part 'theme_mode_state_provider.g.dart'; class ThemeModeState extends _$ThemeModeState { @override bool build() { - return ref.watch(hiveBoxSettings).get('isLight', defaultValue: true)!; + return ref.watch(hiveBoxSettingsProvider).get('isLight', defaultValue: true)!; } void setLightTheme() { state = true; - ref.watch(hiveBoxSettings).put('isLight', state); + ref.watch(hiveBoxSettingsProvider).put('isLight', state); } void setDarkTheme() { state = false; - ref.watch(hiveBoxSettings).put('isLight', state); + ref.watch(hiveBoxSettingsProvider).put('isLight', state); } } diff --git a/lib/views/more/settings/appearance/widgets/theme_selector.dart b/lib/views/more/settings/appearance/widgets/theme_selector.dart index eae56644..31a3f48f 100644 --- a/lib/views/more/settings/appearance/widgets/theme_selector.dart +++ b/lib/views/more/settings/appearance/widgets/theme_selector.dart @@ -21,7 +21,7 @@ class _ThemeSelectorState extends ConsumerState { @override Widget build(BuildContext context) { int selected = - ref.watch(hiveBoxSettings).get('FlexColorIndex', defaultValue: 7); + ref.watch(hiveBoxSettingsProvider).get('FlexColorIndex', defaultValue: 7); const double height = 45; const double width = height * 1.5; final ThemeData theme = Theme.of(context); diff --git a/lib/views/more/settings/categoties/categories_screen.dart b/lib/views/more/settings/categoties/categories_screen.dart new file mode 100644 index 00000000..1d578360 --- /dev/null +++ b/lib/views/more/settings/categoties/categories_screen.dart @@ -0,0 +1,11 @@ +import 'package:flutter/src/widgets/framework.dart'; +import 'package:flutter/src/widgets/placeholder.dart'; + +class CategoriesScreen extends StatelessWidget { + const CategoriesScreen({super.key}); + + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} \ No newline at end of file diff --git a/lib/views/more/settings/providers/incognito_mode_state_provider.dart b/lib/views/more/settings/providers/incognito_mode_state_provider.dart index 20b7c2f0..5ba128c1 100644 --- a/lib/views/more/settings/providers/incognito_mode_state_provider.dart +++ b/lib/views/more/settings/providers/incognito_mode_state_provider.dart @@ -7,12 +7,12 @@ class IncognitoModeState extends _$IncognitoModeState { @override bool build() { return ref - .watch(hiveBoxSettings) + .watch(hiveBoxSettingsProvider) .get('incognitoMode', defaultValue: false)!; } void setIncognitoMode(bool value) { state = value; - ref.watch(hiveBoxSettings).put('incognitoMode', state); + ref.watch(hiveBoxSettingsProvider).put('incognitoMode', state); } }