mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-05-11 08:20:34 +00:00
use riverpod generator
This commit is contained in:
parent
799b5d43f4
commit
667681caa8
27 changed files with 372 additions and 108 deletions
|
|
@ -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<ModelManga>(HiveConstant.hiveBoxManga);
|
||||
await Hive.openBox<MangaHistoryModel>(HiveConstant.hiveBoxMangaHistory);
|
||||
await Hive.openBox<ReaderMode>(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()));
|
||||
}
|
||||
|
||||
|
|
|
|||
15
lib/models/categories.dart
Normal file
15
lib/models/categories.dart
Normal file
|
|
@ -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<ModelManga> listModelManga;
|
||||
CategoriesModel(
|
||||
{required this.id, required this.name, required this.listModelManga});
|
||||
}
|
||||
47
lib/models/categories.g.dart
Normal file
47
lib/models/categories.g.dart
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'categories.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class CategoriesModelAdapter extends TypeAdapter<CategoriesModel> {
|
||||
@override
|
||||
final int typeId = 8;
|
||||
|
||||
@override
|
||||
CategoriesModel read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
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<ModelManga>(),
|
||||
);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
|
@ -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<Box<ModelManga>>((ref) {
|
||||
@riverpod
|
||||
Box<ModelManga> hiveBoxManga(HiveBoxMangaRef ref) {
|
||||
return Hive.box<ModelManga>(HiveConstant.hiveBoxManga);
|
||||
});
|
||||
}
|
||||
|
||||
final hiveBoxMangaInfo = Provider<Box>((ref) {
|
||||
@riverpod
|
||||
Box hiveBoxMangaInfo(HiveBoxMangaInfoRef ref) {
|
||||
return Hive.box(HiveConstant.hiveBoxMangaInfo);
|
||||
});
|
||||
}
|
||||
|
||||
final hiveBoxMangaHistory = Provider<Box<MangaHistoryModel>>((ref) {
|
||||
@riverpod
|
||||
Box<MangaHistoryModel> hiveBoxMangaHistory(HiveBoxMangaHistoryRef ref) {
|
||||
return Hive.box<MangaHistoryModel>(HiveConstant.hiveBoxMangaHistory);
|
||||
});
|
||||
final hiveBoxReaderMode = Provider<Box<ReaderMode>>((ref) {
|
||||
}
|
||||
|
||||
@riverpod
|
||||
Box<ReaderMode> hiveBoxReaderMode(HiveBoxReaderModeRef ref) {
|
||||
return Hive.box<ReaderMode>(HiveConstant.hiveBoxReaderMode);
|
||||
});
|
||||
final hiveBoxMangaFilterProvider = Provider<Box>((ref) {
|
||||
}
|
||||
|
||||
@riverpod
|
||||
Box hiveBoxMangaFilter(HiveBoxMangaFilterRef ref) {
|
||||
return Hive.box(HiveConstant.hiveBoxMangaFilter);
|
||||
});
|
||||
}
|
||||
|
||||
final hiveBoxMangaSourceProvider = Provider<Box<SourceModel>>((ref) {
|
||||
@riverpod
|
||||
Box<SourceModel> hiveBoxMangaSource(HiveBoxMangaSourceRef ref) {
|
||||
return Hive.box<SourceModel>(HiveConstant.hiveBoxMangaSource);
|
||||
});
|
||||
final hiveBoxMangaDownloads = Provider<Box<DownloadModel>>((ref) {
|
||||
return Hive.box<DownloadModel>(HiveConstant.hiveBoxDownloads);
|
||||
});
|
||||
}
|
||||
|
||||
final hiveBoxSettings = Provider<Box>((ref) {
|
||||
@riverpod
|
||||
Box<DownloadModel> hiveBoxMangaDownloads(HiveBoxMangaDownloadsRef ref) {
|
||||
return Hive.box<DownloadModel>(HiveConstant.hiveBoxDownloads);
|
||||
}
|
||||
|
||||
@riverpod
|
||||
Box hiveBoxSettings(HiveBoxSettingsRef ref) {
|
||||
return Hive.box(HiveConstant.hiveBoxAppSettings);
|
||||
});
|
||||
}
|
||||
|
||||
@riverpod
|
||||
Box<CategoriesModel> hiveBoxCategories(HiveBoxCategoriesRef ref) {
|
||||
return Hive.box(HiveConstant.hiveBoxCategories);
|
||||
}
|
||||
|
|
|
|||
151
lib/providers/hive_provider.g.dart
Normal file
151
lib/providers/hive_provider.g.dart
Normal file
|
|
@ -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<Box<ModelManga>>.internal(
|
||||
hiveBoxManga,
|
||||
name: r'hiveBoxMangaProvider',
|
||||
debugGetCreateSourceHash:
|
||||
const bool.fromEnvironment('dart.vm.product') ? null : _$hiveBoxMangaHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef HiveBoxMangaRef = AutoDisposeProviderRef<Box<ModelManga>>;
|
||||
String _$hiveBoxMangaInfoHash() => r'638c65c996c731a9764acc5911f9b0ec75b60273';
|
||||
|
||||
/// See also [hiveBoxMangaInfo].
|
||||
@ProviderFor(hiveBoxMangaInfo)
|
||||
final hiveBoxMangaInfoProvider = AutoDisposeProvider<Box<dynamic>>.internal(
|
||||
hiveBoxMangaInfo,
|
||||
name: r'hiveBoxMangaInfoProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$hiveBoxMangaInfoHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef HiveBoxMangaInfoRef = AutoDisposeProviderRef<Box<dynamic>>;
|
||||
String _$hiveBoxMangaHistoryHash() =>
|
||||
r'dd5c7a3cd8bfceb7b577c56f5ef8755914416c1e';
|
||||
|
||||
/// See also [hiveBoxMangaHistory].
|
||||
@ProviderFor(hiveBoxMangaHistory)
|
||||
final hiveBoxMangaHistoryProvider =
|
||||
AutoDisposeProvider<Box<MangaHistoryModel>>.internal(
|
||||
hiveBoxMangaHistory,
|
||||
name: r'hiveBoxMangaHistoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$hiveBoxMangaHistoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef HiveBoxMangaHistoryRef = AutoDisposeProviderRef<Box<MangaHistoryModel>>;
|
||||
String _$hiveBoxReaderModeHash() => r'fabc2f9e6b46c1ba0f1965630ff91f0bdccfeb99';
|
||||
|
||||
/// See also [hiveBoxReaderMode].
|
||||
@ProviderFor(hiveBoxReaderMode)
|
||||
final hiveBoxReaderModeProvider = AutoDisposeProvider<Box<ReaderMode>>.internal(
|
||||
hiveBoxReaderMode,
|
||||
name: r'hiveBoxReaderModeProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$hiveBoxReaderModeHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef HiveBoxReaderModeRef = AutoDisposeProviderRef<Box<ReaderMode>>;
|
||||
String _$hiveBoxMangaFilterHash() =>
|
||||
r'fe7604bc1dd46517a81f669fe11a8898d89aca44';
|
||||
|
||||
/// See also [hiveBoxMangaFilter].
|
||||
@ProviderFor(hiveBoxMangaFilter)
|
||||
final hiveBoxMangaFilterProvider = AutoDisposeProvider<Box<dynamic>>.internal(
|
||||
hiveBoxMangaFilter,
|
||||
name: r'hiveBoxMangaFilterProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$hiveBoxMangaFilterHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef HiveBoxMangaFilterRef = AutoDisposeProviderRef<Box<dynamic>>;
|
||||
String _$hiveBoxMangaSourceHash() =>
|
||||
r'9620aa7034d4efb0cb5a06276db8e308e4b22c83';
|
||||
|
||||
/// See also [hiveBoxMangaSource].
|
||||
@ProviderFor(hiveBoxMangaSource)
|
||||
final hiveBoxMangaSourceProvider =
|
||||
AutoDisposeProvider<Box<SourceModel>>.internal(
|
||||
hiveBoxMangaSource,
|
||||
name: r'hiveBoxMangaSourceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$hiveBoxMangaSourceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef HiveBoxMangaSourceRef = AutoDisposeProviderRef<Box<SourceModel>>;
|
||||
String _$hiveBoxMangaDownloadsHash() =>
|
||||
r'8c01ad805facb717b531f6f21b87f35f4fd58a6b';
|
||||
|
||||
/// See also [hiveBoxMangaDownloads].
|
||||
@ProviderFor(hiveBoxMangaDownloads)
|
||||
final hiveBoxMangaDownloadsProvider =
|
||||
AutoDisposeProvider<Box<DownloadModel>>.internal(
|
||||
hiveBoxMangaDownloads,
|
||||
name: r'hiveBoxMangaDownloadsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$hiveBoxMangaDownloadsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef HiveBoxMangaDownloadsRef = AutoDisposeProviderRef<Box<DownloadModel>>;
|
||||
String _$hiveBoxSettingsHash() => r'3e948a0ae8fc23d691aeb3e39032007b07f33290';
|
||||
|
||||
/// See also [hiveBoxSettings].
|
||||
@ProviderFor(hiveBoxSettings)
|
||||
final hiveBoxSettingsProvider = AutoDisposeProvider<Box<dynamic>>.internal(
|
||||
hiveBoxSettings,
|
||||
name: r'hiveBoxSettingsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$hiveBoxSettingsHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef HiveBoxSettingsRef = AutoDisposeProviderRef<Box<dynamic>>;
|
||||
String _$hiveBoxCategoriesHash() => r'615bfbed369d04371e7403052fea307f001d61fd';
|
||||
|
||||
/// See also [hiveBoxCategories].
|
||||
@ProviderFor(hiveBoxCategories)
|
||||
final hiveBoxCategoriesProvider =
|
||||
AutoDisposeProvider<Box<CategoriesModel>>.internal(
|
||||
hiveBoxCategories,
|
||||
name: r'hiveBoxCategoriesProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$hiveBoxCategoriesHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef HiveBoxCategoriesRef = AutoDisposeProviderRef<Box<CategoriesModel>>;
|
||||
// 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
|
||||
|
|
@ -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(),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ Future<GetMangaChapterUrlModel> 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<GetMangaChapterUrlModel> getMangaChapterUrl(
|
|||
|
||||
List<bool> 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<GetMangaChapterUrlModel> 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<GetMangaChapterUrlModel> 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<GetMangaChapterUrlModel> 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<GetMangaChapterUrlModel> 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<GetMangaChapterUrlModel> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class _HistoryScreenState extends ConsumerState<HistoryScreen> {
|
|||
),
|
||||
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<HistoryScreen> {
|
|||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: ValueListenableBuilder<Box<MangaHistoryModel>>(
|
||||
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<HistoryScreen> {
|
|||
Flexible(
|
||||
child: ValueListenableBuilder<Box>(
|
||||
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<HistoryScreen> {
|
|||
onPressed: () {
|
||||
ref
|
||||
.watch(
|
||||
hiveBoxMangaHistory)
|
||||
hiveBoxMangaHistoryProvider)
|
||||
.delete(
|
||||
'${element.modelManga.lang}-${element.modelManga.link}');
|
||||
Navigator.pop(
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
],
|
||||
),
|
||||
body: ValueListenableBuilder<Box<ModelManga>>(
|
||||
valueListenable: ref.watch(hiveBoxManga).listenable(),
|
||||
valueListenable: ref.watch(hiveBoxMangaProvider).listenable(),
|
||||
builder: (context, value, child) {
|
||||
entries = value.values.where((element) => element.favorite).toList();
|
||||
final data =
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ class _MangaDetailsViewState extends ConsumerState<MangaDetailsView> {
|
|||
|
||||
@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<Box>(
|
||||
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<MangaDetailsView> {
|
|||
],
|
||||
),
|
||||
action: ValueListenableBuilder<Box<ModelManga>>(
|
||||
valueListenable: ref.watch(hiveBoxManga).listenable(),
|
||||
valueListenable: ref.watch(hiveBoxMangaProvider).listenable(),
|
||||
builder: (context, value, child) {
|
||||
final entries = value.values
|
||||
.where((element) =>
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class _MangaReaderDetailState extends ConsumerState<MangaReaderDetail> {
|
|||
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<MangaReaderDetail> {
|
|||
}
|
||||
},
|
||||
child: ValueListenableBuilder<Box<ModelManga>>(
|
||||
valueListenable: ref.watch(hiveBoxManga).listenable(),
|
||||
valueListenable: ref.watch(hiveBoxMangaProvider).listenable(),
|
||||
builder: (context, value, child) {
|
||||
final entries = value.values
|
||||
.where((element) =>
|
||||
|
|
|
|||
|
|
@ -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<ModelChapters> 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<ModelChapters> 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 ==
|
||||
|
|
|
|||
|
|
@ -687,7 +687,7 @@ class ChapterSetIsBookmarkStateProvider extends AutoDisposeNotifierProviderImpl<
|
|||
}
|
||||
|
||||
String _$chapterSetIsReadStateHash() =>
|
||||
r'432210665b22f1ff141d906135a381f88f3ccec5';
|
||||
r'9435f9d17d5d1fdcfab0279e93d964bd2e4d1fbb';
|
||||
|
||||
abstract class _$ChapterSetIsReadState
|
||||
extends BuildlessAutoDisposeNotifier<dynamic> {
|
||||
|
|
@ -786,7 +786,7 @@ class ChapterSetIsReadStateProvider
|
|||
}
|
||||
|
||||
String _$chapterSetDownloadStateHash() =>
|
||||
r'88cb112fa193aab93e07cd8dca7d7bc54337cb3a';
|
||||
r'9c27161d2eedd2e8d55281d9f5640e4459926d6f';
|
||||
|
||||
abstract class _$ChapterSetDownloadState
|
||||
extends BuildlessAutoDisposeNotifier<dynamic> {
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@ class _ChapterPageDownloadState extends ConsumerState<ChapterPageDownload>
|
|||
|
||||
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<ChapterPageDownload>
|
|||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
child: ValueListenableBuilder<Box<DownloadModel>>(
|
||||
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<ChapterPageDownload>
|
|||
.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<ChapterPageDownload>
|
|||
.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<ChapterPageDownload>
|
|||
),
|
||||
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<ChapterPageDownload>
|
|||
.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!,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ Future<List<dynamic>> downloadChapter(DownloadChapterRef ref,
|
|||
isStartDownload: false);
|
||||
|
||||
ref
|
||||
.watch(hiveBoxMangaDownloads)
|
||||
.watch(hiveBoxMangaDownloadsProvider)
|
||||
.put(modelManga.chapters![index].name!, model);
|
||||
} else {
|
||||
await FileDownloader().downloadBatch(
|
||||
|
|
|
|||
|
|
@ -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) -
|
||||
|
|
|
|||
|
|
@ -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<dynamic> page = ref.watch(hiveBoxMangaInfo).get(
|
||||
List<dynamic> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class DownloadQueueScreen extends ConsumerWidget {
|
|||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return ValueListenableBuilder<Box<DownloadModel>>(
|
||||
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,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class MoreScreen extends StatelessWidget {
|
|||
),
|
||||
ListTileWidget(
|
||||
onTap: () {
|
||||
context.push('/settings');
|
||||
context.push('/categories');
|
||||
},
|
||||
icon: Icons.label_rounded,
|
||||
title: 'Categories',
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class _ThemeSelectorState extends ConsumerState<ThemeSelector> {
|
|||
@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);
|
||||
|
|
|
|||
11
lib/views/more/settings/categoties/categories_screen.dart
Normal file
11
lib/views/more/settings/categoties/categories_screen.dart
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue