mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-20 23:22:07 +00:00
Fix
This commit is contained in:
parent
b46c69dace
commit
247652120b
4 changed files with 131 additions and 112 deletions
|
|
@ -5,6 +5,7 @@ import 'package:flex_color_scheme/flex_color_scheme.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/date_symbol_data_local.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
|
@ -55,7 +56,7 @@ void main(List<String> args) async {
|
|||
// Initialize the Isar database.
|
||||
isar = await StorageProvider().initDB(null, inspector: kDebugMode);
|
||||
await StorageProvider().requestPermission();
|
||||
|
||||
GoogleFonts.aBeeZee();
|
||||
// Start the app.
|
||||
runApp(const ProviderScope(child: MyApp()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,93 +286,96 @@ class _MangaChapterPageGalleryState
|
|||
maxWidth: context.mediaWidth(1),
|
||||
),
|
||||
builder: (context) {
|
||||
return SizedBox(
|
||||
height: 120,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20)),
|
||||
color: context.themeData.scaffoldBackgroundColor),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
height: 7,
|
||||
width: 35,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
color: context.secondaryColor.withOpacity(0.4)),
|
||||
return ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20)),
|
||||
color: context.themeData.scaffoldBackgroundColor),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
height: 7,
|
||||
width: 35,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
color: context.secondaryColor.withOpacity(0.4)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
button(context.l10n.set_as_cover, Icons.image_outlined,
|
||||
() async {
|
||||
final res = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
content:
|
||||
Text(context.l10n.use_this_as_cover_art),
|
||||
actions: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(context.l10n.cancel)),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
final manga =
|
||||
widget.chapter.manga.value!;
|
||||
isar.writeTxnSync(() {
|
||||
isar.mangas.putSync(manga
|
||||
..customCoverImage =
|
||||
imageBytes);
|
||||
});
|
||||
if (mounted) {
|
||||
Navigator.pop(context, "ok");
|
||||
}
|
||||
},
|
||||
child: Text(context.l10n.ok)),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
if (res != null && res == "ok" && context.mounted) {
|
||||
Navigator.pop(context);
|
||||
botToast(context.l10n.cover_updated, second: 3);
|
||||
}
|
||||
}),
|
||||
button(context.l10n.share, Icons.share_outlined,
|
||||
() async {
|
||||
await Share.shareXFiles([
|
||||
XFile.fromData(imageBytes,
|
||||
name: name, mimeType: 'image/png')
|
||||
]);
|
||||
}),
|
||||
button(context.l10n.save, Icons.save_outlined, () async {
|
||||
final dir =
|
||||
await StorageProvider().getGalleryDirectory();
|
||||
final file = File("${dir!.path}/$name.png");
|
||||
file.writeAsBytesSync(imageBytes);
|
||||
if (context.mounted) {
|
||||
botToast(context.l10n.picture_saved, second: 3);
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
],
|
||||
Row(
|
||||
children: [
|
||||
button(context.l10n.set_as_cover, Icons.image_outlined,
|
||||
() async {
|
||||
final res = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
content:
|
||||
Text(context.l10n.use_this_as_cover_art),
|
||||
actions: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(context.l10n.cancel)),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
final manga =
|
||||
widget.chapter.manga.value!;
|
||||
isar.writeTxnSync(() {
|
||||
isar.mangas.putSync(manga
|
||||
..customCoverImage =
|
||||
imageBytes);
|
||||
});
|
||||
if (mounted) {
|
||||
Navigator.pop(context, "ok");
|
||||
}
|
||||
},
|
||||
child: Text(context.l10n.ok)),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
if (res != null && res == "ok" && context.mounted) {
|
||||
Navigator.pop(context);
|
||||
botToast(context.l10n.cover_updated, second: 3);
|
||||
}
|
||||
}),
|
||||
button(context.l10n.share, Icons.share_outlined,
|
||||
() async {
|
||||
await Share.shareXFiles([
|
||||
XFile.fromData(imageBytes,
|
||||
name: name, mimeType: 'image/png')
|
||||
]);
|
||||
}),
|
||||
button(context.l10n.save, Icons.save_outlined,
|
||||
() async {
|
||||
final dir =
|
||||
await StorageProvider().getGalleryDirectory();
|
||||
final file = File("${dir!.path}/$name.png");
|
||||
file.writeAsBytesSync(imageBytes);
|
||||
if (context.mounted) {
|
||||
botToast(context.l10n.picture_saved, second: 3);
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
@ -1371,8 +1374,7 @@ class _MangaChapterPageGalleryState
|
|||
Map<String, dynamic> data = {
|
||||
'url': url,
|
||||
'sourceId': source.id.toString(),
|
||||
'title': chapter.name!,
|
||||
"hasCloudFlare": source.hasCloudflare ?? false
|
||||
'title': chapter.name!
|
||||
};
|
||||
if (Platform.isLinux) {
|
||||
final urll = Uri.parse(url);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:mangayomi/modules/more/settings/appearance/providers/app_font_family.dart';
|
||||
import 'package:mangayomi/modules/more/settings/appearance/providers/theme_mode_state_provider.dart';
|
||||
import 'package:mangayomi/modules/widgets/draggable_scroll_bar.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/date.dart';
|
||||
|
|
@ -152,6 +153,7 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
ListTile(
|
||||
onTap: () {
|
||||
String textValue = "";
|
||||
final controller = ScrollController();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
|
|
@ -203,29 +205,34 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
textValue.toLowerCase()))
|
||||
.toList();
|
||||
return Flexible(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: values.length,
|
||||
itemBuilder: (context, index) {
|
||||
final value = values[index];
|
||||
return RadioListTile(
|
||||
dense: true,
|
||||
contentPadding:
|
||||
const EdgeInsets.all(0),
|
||||
value:
|
||||
value.value().fontFamily,
|
||||
groupValue: appFontFamily,
|
||||
onChanged: (value) {
|
||||
ref
|
||||
.read(
|
||||
appFontFamilyProvider
|
||||
.notifier)
|
||||
.set(value);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
title: Text(value.key),
|
||||
);
|
||||
},
|
||||
child: DraggableScrollbarWidget(
|
||||
controller: controller,
|
||||
child: ListView.builder(
|
||||
controller: controller,
|
||||
shrinkWrap: true,
|
||||
itemCount: values.length,
|
||||
itemBuilder: (context, index) {
|
||||
final value = values[index];
|
||||
return RadioListTile(
|
||||
dense: true,
|
||||
contentPadding:
|
||||
const EdgeInsets.all(0),
|
||||
value: value
|
||||
.value()
|
||||
.fontFamily,
|
||||
groupValue: appFontFamily,
|
||||
onChanged: (value) {
|
||||
ref
|
||||
.read(
|
||||
appFontFamilyProvider
|
||||
.notifier)
|
||||
.set(value);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
title: Text(value.key),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:mangayomi/main.dart';
|
||||
import 'package:mangayomi/models/settings.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
|
@ -7,7 +8,15 @@ part 'app_font_family.g.dart';
|
|||
class AppFontFamily extends _$AppFontFamily {
|
||||
@override
|
||||
String? build() {
|
||||
return isar.settings.getSync(227)!.appFontFamily;
|
||||
final fontFamily = isar.settings.getSync(227)!.appFontFamily;
|
||||
if (fontFamily == null) return null;
|
||||
|
||||
return GoogleFonts.asMap()
|
||||
.entries
|
||||
.toList()
|
||||
.firstWhere((element) => element.value().fontFamily! == fontFamily)
|
||||
.value()
|
||||
.fontFamily;
|
||||
}
|
||||
|
||||
void set(String? fontFamily) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue