mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-03-11 17:25:32 +00:00
Relocate extensions
-refactor -also modify display widget in library draggabalble menu
This commit is contained in:
parent
ea986befee
commit
9d55733e97
68 changed files with 546 additions and 548 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:html/dom.dart';
|
||||
import 'package:mangayomi/eval/model/element.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/dom_extensions.dart';
|
||||
|
||||
class MDocument {
|
||||
const MDocument(this._document);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:html/dom.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/dom_extensions.dart';
|
||||
|
||||
class MElement {
|
||||
MElement(this._element);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import 'package:mangayomi/services/cloudflare/cloudflare.dart';
|
|||
import 'package:mangayomi/utils/constant.dart';
|
||||
import 'package:mangayomi/utils/cryptoaes/crypto_aes.dart';
|
||||
import 'package:mangayomi/utils/cryptoaes/deobfuscator.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/utils/reg_exp_matcher.dart';
|
||||
import 'package:mangayomi/utils/xpath_selector.dart';
|
||||
import 'package:xpath_selector_html_parser/xpath_selector_html_parser.dart';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import 'package:mangayomi/modules/more/settings/player/providers/player_state_pr
|
|||
import 'package:mangayomi/modules/widgets/progress_center.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/services/get_video_list.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart';
|
||||
import 'package:media_kit_video/media_kit_video_controls/src/controls/extensions/duration.dart';
|
||||
|
|
@ -395,7 +395,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
Container(
|
||||
color: Colors.white,
|
||||
width: 0.2,
|
||||
height: mediaHeight(context, 1)),
|
||||
height: context.mediaHeight(1)),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
|
|
@ -429,7 +429,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
Container(
|
||||
color: Colors.white,
|
||||
width: 0.2,
|
||||
height: mediaHeight(context, 1)),
|
||||
height: context.mediaHeight(1)),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
|
|
@ -979,7 +979,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
child: ListTile(
|
||||
dense: true,
|
||||
title: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: Text(
|
||||
widget.episode.manga.value!.name!,
|
||||
style: const TextStyle(
|
||||
|
|
@ -988,7 +988,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
),
|
||||
),
|
||||
subtitle: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: Text(
|
||||
widget.episode.name!,
|
||||
style: TextStyle(
|
||||
|
|
@ -1009,8 +1009,8 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
if (mounted) {
|
||||
_key.currentState?.update(
|
||||
fit: fit,
|
||||
width: mediaWidth(context, 1),
|
||||
height: mediaHeight(context, 1));
|
||||
width: context.mediaWidth(1),
|
||||
height: context.mediaHeight(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1056,8 +1056,8 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
streamController: _streamController,
|
||||
),
|
||||
controller: _controller,
|
||||
width: mediaWidth(context, 1),
|
||||
height: mediaHeight(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: context.mediaHeight(1),
|
||||
resumeUponEnteringForegroundMode: true,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@ import 'package:mangayomi/modules/browse/extension/providers/extension_preferenc
|
|||
import 'package:mangayomi/modules/browse/extension/widgets/source_preference_widget.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/services/get_source_preference.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/language.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
|
||||
class ExtensionDetail extends ConsumerStatefulWidget {
|
||||
final Source source;
|
||||
|
|
@ -67,7 +66,8 @@ class _ExtensionDetailState extends ConsumerState<ExtensionDetail> {
|
|||
padding: const EdgeInsets.all(12),
|
||||
child: Text(
|
||||
widget.source.name!,
|
||||
style: const TextStyle(fontSize: 23, fontWeight: FontWeight.bold),
|
||||
style:
|
||||
const TextStyle(fontSize: 23, fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
|
@ -75,7 +75,7 @@ class _ExtensionDetailState extends ConsumerState<ExtensionDetail> {
|
|||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor(context).withOpacity(0.2),
|
||||
color: context.primaryColor.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
|
|
@ -130,12 +130,12 @@ class _ExtensionDetailState extends ConsumerState<ExtensionDetail> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: SizedBox(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.all(0),
|
||||
side:
|
||||
BorderSide(color: primaryColor(context), width: 0.3),
|
||||
BorderSide(color: context.primaryColor, width: 0.3),
|
||||
backgroundColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5)),
|
||||
|
|
@ -149,8 +149,8 @@ class _ExtensionDetailState extends ConsumerState<ExtensionDetail> {
|
|||
title: Text(
|
||||
widget.source.name!,
|
||||
),
|
||||
content: Text(
|
||||
l10n.uninstall_extension(widget.source.name!)),
|
||||
content: Text(l10n
|
||||
.uninstall_extension(widget.source.name!)),
|
||||
actions: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ import 'package:mangayomi/models/source.dart';
|
|||
import 'package:mangayomi/modules/browse/extension/providers/extension_preferences_providers.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/widgets/chapter_filter_list_tile_widget.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class SourcePreferenceWidget extends StatefulWidget {
|
||||
final List<SourcePreference> sourcePreference;
|
||||
|
|
@ -33,7 +32,7 @@ class _SourcePreferenceWidgetState extends State<SourcePreferenceWidget> {
|
|||
title: Text(pref.title!),
|
||||
subtitle: Text(pref.summary!,
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context))),
|
||||
fontSize: 11, color: context.secondaryColor)),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
|
|
@ -55,7 +54,7 @@ class _SourcePreferenceWidgetState extends State<SourcePreferenceWidget> {
|
|||
title: Text(pref.title!),
|
||||
subtitle: Text(pref.summary!,
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context))),
|
||||
fontSize: 11, color: context.secondaryColor)),
|
||||
value: pref.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
|
|
@ -71,7 +70,7 @@ class _SourcePreferenceWidgetState extends State<SourcePreferenceWidget> {
|
|||
title: Text(pref.title!),
|
||||
subtitle: Text(pref.summary!,
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context))),
|
||||
fontSize: 11, color: context.secondaryColor)),
|
||||
value: pref.value!,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
|
|
@ -87,14 +86,14 @@ class _SourcePreferenceWidgetState extends State<SourcePreferenceWidget> {
|
|||
title: Text(pref.title!),
|
||||
subtitle: Text(pref.entries![pref.valueIndex!],
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context))),
|
||||
fontSize: 11, color: context.secondaryColor)),
|
||||
onTap: () async {
|
||||
final res = await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(pref.title!),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: pref.entries!.length,
|
||||
|
|
@ -124,7 +123,7 @@ class _SourcePreferenceWidgetState extends State<SourcePreferenceWidget> {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -144,7 +143,7 @@ class _SourcePreferenceWidgetState extends State<SourcePreferenceWidget> {
|
|||
title: Text(pref.title!),
|
||||
subtitle: Text(pref.summary!,
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context))),
|
||||
fontSize: 11, color: context.secondaryColor)),
|
||||
onTap: () {
|
||||
List<String> indexList = [];
|
||||
indexList.addAll(pref.values!);
|
||||
|
|
@ -156,7 +155,7 @@ class _SourcePreferenceWidgetState extends State<SourcePreferenceWidget> {
|
|||
return AlertDialog(
|
||||
title: Text(pref.title!),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: pref.entries!.length,
|
||||
|
|
@ -198,7 +197,7 @@ class _SourcePreferenceWidgetState extends State<SourcePreferenceWidget> {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
|
|
@ -207,7 +206,7 @@ class _SourcePreferenceWidgetState extends State<SourcePreferenceWidget> {
|
|||
child: Text(
|
||||
context.l10n.ok,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -264,10 +263,10 @@ class _EditTextDialogWidgetState extends State<EditTextDialogWidget> {
|
|||
isDense: true,
|
||||
filled: false,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: secondaryColor(context)),
|
||||
borderSide: BorderSide(color: context.secondaryColor),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor(context)),
|
||||
borderSide: BorderSide(color: context.primaryColor),
|
||||
),
|
||||
border: const OutlineInputBorder(borderSide: BorderSide()),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import 'package:mangayomi/router/router.dart';
|
|||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/services/search_.dart';
|
||||
import 'package:mangayomi/utils/cached_network.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
import 'package:mangayomi/utils/headers.dart';
|
||||
import 'package:mangayomi/utils/language.dart';
|
||||
|
|
@ -308,7 +308,7 @@ class _MangaGlobalImageCardState extends ConsumerState<MangaGlobalImageCard>
|
|||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Icon(Icons.collections_bookmark,
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
))
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import 'package:mangayomi/main.dart';
|
|||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/sources/source_test.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/language.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ class SourceListTile extends StatelessWidget {
|
|||
},
|
||||
icon: Icon(
|
||||
Icons.push_pin_outlined,
|
||||
color: source.isPinned! ? primaryColor(context) : null,
|
||||
color: source.isPinned! ? context.primaryColor : null,
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@ import 'package:mangayomi/modules/more/categories/providers/isar_providers.dart'
|
|||
import 'package:mangayomi/modules/widgets/manga_image_card_widget.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/providers/storage_provider.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/modules/library/providers/isar_providers.dart';
|
||||
import 'package:mangayomi/modules/library/providers/library_state_provider.dart';
|
||||
import 'package:mangayomi/modules/library/widgets/search_text_form_field.dart';
|
||||
|
|
@ -455,13 +454,13 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
return AnimatedContainer(
|
||||
curve: Curves.easeIn,
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor(context).withOpacity(0.2),
|
||||
color: context.primaryColor.withOpacity(0.2),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20))),
|
||||
duration: const Duration(milliseconds: 100),
|
||||
height: isLongPressed ? 70 : 0,
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
|
|
@ -661,10 +660,8 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
)
|
||||
: LibraryGridViewWidget(
|
||||
entriesManga: entriesManga,
|
||||
isCoverOnlyGrid:
|
||||
displayType == DisplayType.compactGrid ? false : true,
|
||||
isComfortableGrid:
|
||||
displayType == DisplayType.comfortableGrid ? true : false,
|
||||
isCoverOnlyGrid: !(displayType == DisplayType.compactGrid),
|
||||
isComfortableGrid: displayType == DisplayType.comfortableGrid,
|
||||
continueReaderBtn: continueReaderBtn,
|
||||
downloadedChapter: downloadedChapter,
|
||||
language: language,
|
||||
|
|
@ -730,10 +727,8 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
)
|
||||
: LibraryGridViewWidget(
|
||||
entriesManga: entriesManga,
|
||||
isCoverOnlyGrid:
|
||||
displayType == DisplayType.compactGrid ? false : true,
|
||||
isComfortableGrid:
|
||||
displayType == DisplayType.comfortableGrid ? true : false,
|
||||
isCoverOnlyGrid: !(displayType == DisplayType.compactGrid),
|
||||
isComfortableGrid: displayType == DisplayType.comfortableGrid,
|
||||
continueReaderBtn: continueReaderBtn,
|
||||
downloadedChapter: downloadedChapter,
|
||||
language: language,
|
||||
|
|
@ -921,7 +916,7 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
l10n.set_categories,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: Builder(builder: (context) {
|
||||
if (snapshot.hasData && snapshot.data!.isNotEmpty) {
|
||||
final entries = snapshot.data!;
|
||||
|
|
@ -1057,7 +1052,7 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
),
|
||||
content: SizedBox(
|
||||
height: 100,
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: Column(
|
||||
children: [
|
||||
ListTileChapterFilter(
|
||||
|
|
@ -1381,6 +1376,8 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
physics:
|
||||
const NeverScrollableScrollPhysics(),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
|
|
@ -1391,37 +1388,84 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: DisplayType.values
|
||||
.map(
|
||||
(e) => RadioListTile<
|
||||
DisplayType>(
|
||||
dense: true,
|
||||
title: Text(
|
||||
displayV
|
||||
.getLibraryDisplayTypeName(
|
||||
e.name, context),
|
||||
style: TextStyle(
|
||||
color:
|
||||
Theme.of(context)
|
||||
.textTheme
|
||||
.bodyLarge!
|
||||
.color,
|
||||
fontSize: 14),
|
||||
),
|
||||
value: e,
|
||||
groupValue: displayV
|
||||
.getLibraryDisplayTypeValue(
|
||||
display),
|
||||
selected: true,
|
||||
onChanged: (value) {
|
||||
displayV
|
||||
.setLibraryDisplayType(
|
||||
value!);
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList()),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5, horizontal: 20),
|
||||
child: Wrap(
|
||||
children: DisplayType.values.map(
|
||||
(e) {
|
||||
final selected = e ==
|
||||
displayV
|
||||
.getLibraryDisplayTypeValue(
|
||||
display);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 5),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 15),
|
||||
surfaceTintColor:
|
||||
Colors.transparent,
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
10)),
|
||||
side: selected
|
||||
? null
|
||||
: BorderSide(
|
||||
color: context
|
||||
.isLight
|
||||
? Colors.black
|
||||
: Colors
|
||||
.white,
|
||||
width: 0.8),
|
||||
shadowColor:
|
||||
Colors.transparent,
|
||||
elevation: 0,
|
||||
backgroundColor: selected
|
||||
? context.primaryColor
|
||||
.withOpacity(0.2)
|
||||
: Colors.transparent),
|
||||
onPressed: () {
|
||||
displayV
|
||||
.setLibraryDisplayType(
|
||||
e);
|
||||
},
|
||||
child: Text(
|
||||
displayV
|
||||
.getLibraryDisplayTypeName(
|
||||
e.name, context),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyLarge!
|
||||
.color,
|
||||
fontSize: 14),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
// RadioListTile<
|
||||
// DisplayType>(
|
||||
// dense: true,
|
||||
// title: ,
|
||||
// value: e,
|
||||
// groupValue: displayV
|
||||
// .getLibraryDisplayTypeValue(
|
||||
// display),
|
||||
// selected: true,
|
||||
// onChanged: (value) {
|
||||
// displayV
|
||||
// .setLibraryDisplayType(
|
||||
// value!);
|
||||
// },
|
||||
// ),
|
||||
).toList()),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20, top: 10),
|
||||
|
|
@ -1478,6 +1522,22 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
.notifier)
|
||||
.set(!localSource);
|
||||
}),
|
||||
ListTileChapterFilter(
|
||||
label: l10n
|
||||
.show_continue_reading_buttons,
|
||||
type:
|
||||
continueReaderBtn ? 1 : 0,
|
||||
onTap: () {
|
||||
ref
|
||||
.read(libraryShowContinueReadingButtonStateProvider(
|
||||
isManga: widget
|
||||
.isManga,
|
||||
settings:
|
||||
settings)
|
||||
.notifier)
|
||||
.set(
|
||||
!continueReaderBtn);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -1528,39 +1588,6 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20, top: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(l10n.other),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 5),
|
||||
child: Column(
|
||||
children: [
|
||||
ListTileChapterFilter(
|
||||
label: l10n
|
||||
.show_continue_reading_buttons,
|
||||
type:
|
||||
continueReaderBtn ? 1 : 0,
|
||||
onTap: () {
|
||||
ref
|
||||
.read(libraryShowContinueReadingButtonStateProvider(
|
||||
isManga: widget
|
||||
.isManga,
|
||||
settings:
|
||||
settings)
|
||||
.notifier)
|
||||
.set(
|
||||
!continueReaderBtn);
|
||||
}),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -1616,7 +1643,7 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
child: AppBar(
|
||||
title: Text(mangaIdsList.length.toString()),
|
||||
backgroundColor: primaryColor(context).withOpacity(0.2),
|
||||
backgroundColor: context.primaryColor.withOpacity(0.2),
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
ref.read(mangasListStateProvider.notifier).clear();
|
||||
|
|
@ -1832,8 +1859,8 @@ _importLocal(BuildContext context, bool isManga) {
|
|||
),
|
||||
if (isLoading)
|
||||
Container(
|
||||
width: mediaWidth(context, 1),
|
||||
height: mediaHeight(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: context.mediaHeight(1),
|
||||
color: Colors.transparent,
|
||||
child: UnconstrainedBox(
|
||||
child: Container(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import 'package:mangayomi/modules/history/providers/isar_providers.dart';
|
|||
import 'package:mangayomi/modules/library/providers/library_state_provider.dart';
|
||||
import 'package:mangayomi/modules/manga/reader/providers/push_router.dart';
|
||||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
import 'package:mangayomi/utils/headers.dart';
|
||||
import 'package:mangayomi/modules/more/providers/incognito_mode_state_provider.dart';
|
||||
|
|
@ -102,7 +102,7 @@ class LibraryGridViewWidget extends StatelessWidget {
|
|||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
|
|
@ -194,7 +194,7 @@ class LibraryGridViewWidget extends StatelessWidget {
|
|||
child: Padding(
|
||||
padding: const EdgeInsets.all(5),
|
||||
child: Container(
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(
|
||||
|
|
@ -248,7 +248,7 @@ class LibraryGridViewWidget extends StatelessWidget {
|
|||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(5),
|
||||
color: primaryColor(context)
|
||||
color: context.primaryColor
|
||||
.withOpacity(0.9),
|
||||
),
|
||||
child: const Padding(
|
||||
|
|
@ -274,7 +274,7 @@ class LibraryGridViewWidget extends StatelessWidget {
|
|||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: primaryColor(context)
|
||||
color: context.primaryColor
|
||||
.withOpacity(0.9),
|
||||
),
|
||||
child: const Padding(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import 'package:mangayomi/modules/history/providers/isar_providers.dart';
|
|||
import 'package:mangayomi/modules/library/providers/library_state_provider.dart';
|
||||
import 'package:mangayomi/modules/manga/reader/providers/push_router.dart';
|
||||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
import 'package:mangayomi/utils/headers.dart';
|
||||
import 'package:mangayomi/modules/more/providers/incognito_mode_state_provider.dart';
|
||||
|
|
@ -73,7 +73,7 @@ class LibraryListViewWidget extends StatelessWidget {
|
|||
},
|
||||
child: Container(
|
||||
color: mangaIdsList.contains(entry.id)
|
||||
? primaryColor(context).withOpacity(0.4)
|
||||
? context.primaryColor.withOpacity(0.4)
|
||||
: Colors.transparent,
|
||||
child: Padding(
|
||||
padding:
|
||||
|
|
@ -109,7 +109,7 @@ class LibraryListViewWidget extends StatelessWidget {
|
|||
child: InkWell(
|
||||
child: Container(
|
||||
color: mangaIdsList.contains(entry.id)
|
||||
? primaryColor(context)
|
||||
? context.primaryColor
|
||||
.withOpacity(0.4)
|
||||
: Colors.transparent,
|
||||
)),
|
||||
|
|
@ -131,7 +131,7 @@ class LibraryListViewWidget extends StatelessWidget {
|
|||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
child: SizedBox(
|
||||
height: 22,
|
||||
child: Row(
|
||||
|
|
@ -216,7 +216,7 @@ class LibraryListViewWidget extends StatelessWidget {
|
|||
),
|
||||
if (language && entry.lang!.isNotEmpty)
|
||||
Container(
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(
|
||||
|
|
@ -266,7 +266,7 @@ class LibraryListViewWidget extends StatelessWidget {
|
|||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(5),
|
||||
color: primaryColor(context)
|
||||
color: context.primaryColor
|
||||
.withOpacity(0.9),
|
||||
),
|
||||
child: const Padding(
|
||||
|
|
@ -292,7 +292,7 @@ class LibraryListViewWidget extends StatelessWidget {
|
|||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: primaryColor(context)
|
||||
color: context.primaryColor
|
||||
.withOpacity(0.9),
|
||||
),
|
||||
child: const Padding(
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ import 'package:mangayomi/modules/more/backup_and_restore/providers/auto_backup.
|
|||
import 'package:mangayomi/modules/more/settings/browse/providers/browse_state_provider.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/router/router.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/modules/library/providers/library_state_provider.dart';
|
||||
import 'package:mangayomi/modules/more/providers/incognito_mode_state_provider.dart';
|
||||
|
||||
|
|
@ -62,7 +61,7 @@ class MainScreen extends ConsumerWidget {
|
|||
: 0,
|
||||
curve: Curves.easeIn,
|
||||
duration: const Duration(milliseconds: 150),
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
|
@ -83,7 +82,7 @@ class MainScreen extends ConsumerWidget {
|
|||
),
|
||||
Flexible(
|
||||
child: Scaffold(
|
||||
body: isTablet(context)
|
||||
body: context.isTablet
|
||||
? Row(
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
|
|
@ -186,11 +185,11 @@ class MainScreen extends ConsumerWidget {
|
|||
],
|
||||
)
|
||||
: child,
|
||||
bottomNavigationBar: isTablet(context)
|
||||
bottomNavigationBar: context.isTablet
|
||||
? null
|
||||
: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 0),
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: switch (isLongPressed) {
|
||||
true => 0,
|
||||
_ => switch (location) {
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@ import 'package:mangayomi/modules/more/settings/track/widgets/track_listile.dart
|
|||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/sources/utils/utils.dart';
|
||||
import 'package:mangayomi/utils/cached_network.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/headers.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/utils.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/providers/isar_providers.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/providers/state_providers.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/widgets/readmore.dart';
|
||||
|
|
@ -227,7 +225,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
widget.manga!.customCoverImage != null
|
||||
? Image.memory(
|
||||
widget.manga!.customCoverImage as Uint8List,
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: 300,
|
||||
fit: BoxFit.cover)
|
||||
: cachedNetworkImage(
|
||||
|
|
@ -237,7 +235,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
imageUrl: toImgUrl(
|
||||
widget.manga!.customCoverFromTracker ??
|
||||
widget.manga!.imageUrl!),
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: 300,
|
||||
fit: BoxFit.cover),
|
||||
Stack(
|
||||
|
|
@ -245,9 +243,9 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
Column(
|
||||
children: [
|
||||
Container(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: AppBar().preferredSize.height,
|
||||
color: isTablet(context)
|
||||
color: context.isTablet
|
||||
? Theme.of(context)
|
||||
.scaffoldBackgroundColor
|
||||
: Theme.of(context)
|
||||
|
|
@ -255,9 +253,9 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
.withOpacity(0.9),
|
||||
),
|
||||
Container(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: 465,
|
||||
color: isTablet(context)
|
||||
color: context.isTablet
|
||||
? Theme.of(context)
|
||||
.scaffoldBackgroundColor
|
||||
: Theme.of(context)
|
||||
|
|
@ -269,7 +267,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
Positioned(
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: 100,
|
||||
color: Theme.of(context)
|
||||
.scaffoldBackgroundColor),
|
||||
|
|
@ -299,7 +297,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
child: AppBar(
|
||||
title: Text(chapterList.length.toString()),
|
||||
backgroundColor:
|
||||
primaryColor(context).withOpacity(0.2),
|
||||
context.primaryColor.withOpacity(0.2),
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
ref
|
||||
|
|
@ -420,10 +418,10 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
body: SafeArea(
|
||||
child: Row(
|
||||
children: [
|
||||
if (isTablet(context))
|
||||
if (context.isTablet)
|
||||
SizedBox(
|
||||
width: mediaWidth(context, 0.5),
|
||||
height: mediaHeight(context, 1),
|
||||
width: context.mediaWidth(0.5),
|
||||
height: context.mediaHeight(1),
|
||||
child: SingleChildScrollView(
|
||||
child: _bodyContainer(
|
||||
chapterLength: chapters.length))),
|
||||
|
|
@ -431,7 +429,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
child: DraggableScrollbar(
|
||||
padding: const EdgeInsets.only(right: 7),
|
||||
heightScrollThumb: 48.0,
|
||||
backgroundColor: primaryColor(context),
|
||||
backgroundColor: context.primaryColor,
|
||||
scrollThumbBuilder: (backgroundColor, thumbAnimation,
|
||||
labelAnimation, height,
|
||||
{labelConstraints, labelText}) {
|
||||
|
|
@ -456,7 +454,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
final l10n = l10nLocalizations(context)!;
|
||||
int finalIndex = index - 1;
|
||||
if (index == 0) {
|
||||
return isTablet(context)
|
||||
return context.isTablet
|
||||
? Column(
|
||||
children: [
|
||||
Padding(
|
||||
|
|
@ -469,7 +467,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
children: [
|
||||
Container(
|
||||
height: chapters.isEmpty
|
||||
? mediaHeight(context, 1)
|
||||
? context.mediaHeight(1)
|
||||
: null,
|
||||
color: Theme.of(context)
|
||||
.scaffoldBackgroundColor,
|
||||
|
|
@ -501,8 +499,8 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
.circular(
|
||||
5))),
|
||||
icon: Icon(Icons.add,
|
||||
color: secondaryColor(
|
||||
context)),
|
||||
color: context
|
||||
.secondaryColor),
|
||||
label: Text(
|
||||
widget.manga!.isManga!
|
||||
? l10n.add_chapters
|
||||
|
|
@ -510,8 +508,8 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
style: TextStyle(
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
color: secondaryColor(
|
||||
context)),
|
||||
color: context
|
||||
.secondaryColor),
|
||||
),
|
||||
onPressed: () async {
|
||||
await ref.watch(
|
||||
|
|
@ -559,13 +557,13 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
return AnimatedContainer(
|
||||
curve: Curves.easeIn,
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor(context).withOpacity(0.2),
|
||||
color: context.primaryColor.withOpacity(0.2),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20))),
|
||||
duration: const Duration(milliseconds: 100),
|
||||
height: isLongPressed ? 70 : 0,
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
|
|
@ -935,9 +933,8 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
l10n.filter_scanlator_groups,
|
||||
),
|
||||
content: SizedBox(
|
||||
width:
|
||||
mediaWidth(
|
||||
context,
|
||||
width: context
|
||||
.mediaWidth(
|
||||
0.8),
|
||||
child: ListView
|
||||
.builder(
|
||||
|
|
@ -978,7 +975,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
},
|
||||
child: Text(
|
||||
l10n.reset,
|
||||
style: TextStyle(color: primaryColor(context)),
|
||||
style: TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
|
@ -993,7 +990,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
},
|
||||
child: Text(
|
||||
l10n.cancel,
|
||||
style: TextStyle(color: primaryColor(context)),
|
||||
style: TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
|
@ -1002,7 +999,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
},
|
||||
child: Text(
|
||||
l10n.filter,
|
||||
style: TextStyle(color: primaryColor(context)),
|
||||
style: TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
|
@ -1138,7 +1135,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
child: Row(
|
||||
children: [
|
||||
_coverCard(),
|
||||
|
|
@ -1182,7 +1179,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
? const SizedBox(
|
||||
height: 30,
|
||||
)
|
||||
: _expanded || isTablet(context)
|
||||
: _expanded || context.isTablet
|
||||
? Wrap(
|
||||
children: [
|
||||
for (var i = 0;
|
||||
|
|
@ -1207,7 +1204,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
widget.manga!.genre![i],
|
||||
style: TextStyle(
|
||||
fontSize: 11.5,
|
||||
color: isLight(context)
|
||||
color: context.isLight
|
||||
? Colors.black
|
||||
: Colors.white),
|
||||
),
|
||||
|
|
@ -1243,7 +1240,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
widget.manga!.genre![i],
|
||||
style: TextStyle(
|
||||
fontSize: 11.5,
|
||||
color: isLight(context)
|
||||
color: context.isLight
|
||||
? Colors.black
|
||||
: Colors.white),
|
||||
),
|
||||
|
|
@ -1253,7 +1250,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
],
|
||||
),
|
||||
)),
|
||||
if (!isTablet(context))
|
||||
if (!context.isTablet)
|
||||
Column(
|
||||
children: [
|
||||
//Description
|
||||
|
|
@ -1283,12 +1280,12 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
borderRadius:
|
||||
BorderRadius.circular(5))),
|
||||
icon: Icon(Icons.add,
|
||||
color: secondaryColor(context)),
|
||||
color: context.secondaryColor),
|
||||
label: Text(
|
||||
l10n.add_chapters,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: secondaryColor(context)),
|
||||
color: context.secondaryColor),
|
||||
),
|
||||
onPressed: () async {
|
||||
await ref.watch(
|
||||
|
|
@ -1309,8 +1306,8 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
),
|
||||
if (chapterLength == 0)
|
||||
Container(
|
||||
width: mediaWidth(context, 1),
|
||||
height: mediaHeight(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: context.mediaHeight(1),
|
||||
color: Theme.of(context).scaffoldBackgroundColor)
|
||||
],
|
||||
),
|
||||
|
|
@ -1403,8 +1400,8 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
snapshot.hasData ? snapshot.data : [];
|
||||
bool isNotEmpty = trackRes!.isNotEmpty;
|
||||
Color color = isNotEmpty
|
||||
? primaryColor(context)
|
||||
: secondaryColor(context);
|
||||
? context.primaryColor
|
||||
: context.secondaryColor;
|
||||
return Column(
|
||||
children: [
|
||||
Icon(
|
||||
|
|
@ -1459,7 +1456,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
Icon(
|
||||
Icons.public,
|
||||
size: 20,
|
||||
color: secondaryColor(context),
|
||||
color: context.secondaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
|
|
@ -1467,7 +1464,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
Text(
|
||||
'WebView',
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context)),
|
||||
fontSize: 11, color: context.secondaryColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
@ -1742,7 +1739,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
barItem: Container(),
|
||||
color: Theme.of(context).scaffoldBackgroundColor),
|
||||
child: Material(
|
||||
color: isLight(context)
|
||||
color: context.isLight
|
||||
? Theme.of(context).scaffoldBackgroundColor.withOpacity(0.9)
|
||||
: !ref.watch(pureBlackDarkModeStateProvider)
|
||||
? Theme.of(context).scaffoldBackgroundColor.withOpacity(0.9)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,8 @@ import 'package:mangayomi/modules/manga/detail/widgets/custom_floating_action_bt
|
|||
import 'package:mangayomi/modules/manga/reader/providers/push_router.dart';
|
||||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/manga_detail_view.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/providers/state_providers.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/widgets/chapter_filter_list_tile_widget.dart';
|
||||
|
|
@ -203,7 +202,7 @@ class _MangaDetailsViewState extends ConsumerState<MangaDetailsView> {
|
|||
Icon(
|
||||
Icons.favorite_border_rounded,
|
||||
size: 20,
|
||||
color: secondaryColor(context),
|
||||
color: context.secondaryColor,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
|
|
@ -211,7 +210,7 @@ class _MangaDetailsViewState extends ConsumerState<MangaDetailsView> {
|
|||
Text(
|
||||
l10n.add_to_library,
|
||||
style: TextStyle(
|
||||
color: secondaryColor(context), fontSize: 11),
|
||||
color: context.secondaryColor, fontSize: 11),
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
],
|
||||
|
|
@ -240,7 +239,7 @@ class _MangaDetailsViewState extends ConsumerState<MangaDetailsView> {
|
|||
l10n.set_categories,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: StreamBuilder(
|
||||
stream: isar.categorys
|
||||
.filter()
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@ import 'package:mangayomi/models/chapter.dart';
|
|||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/date.dart';
|
||||
import 'package:mangayomi/modules/manga/reader/providers/push_router.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/utils.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/providers/state_providers.dart';
|
||||
import 'package:mangayomi/modules/manga/download/download_page_widget.dart';
|
||||
|
||||
|
|
@ -27,11 +26,11 @@ class ChapterListTileWidget extends ConsumerWidget {
|
|||
final l10n = l10nLocalizations(context)!;
|
||||
return Container(
|
||||
color: chapterList.contains(chapter)
|
||||
? primaryColor(context).withOpacity(0.4)
|
||||
? context.primaryColor.withOpacity(0.4)
|
||||
: null,
|
||||
child: ListTile(
|
||||
textColor: chapter.isRead!
|
||||
? isLight(context)
|
||||
? context.isLight
|
||||
? Colors.black.withOpacity(0.4)
|
||||
: Colors.white.withOpacity(0.3)
|
||||
: null,
|
||||
|
|
@ -61,7 +60,7 @@ class ChapterListTileWidget extends ConsumerWidget {
|
|||
? Icon(
|
||||
Icons.bookmark,
|
||||
size: 16,
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
)
|
||||
: Container(),
|
||||
Flexible(
|
||||
|
|
@ -99,7 +98,7 @@ class ChapterListTileWidget extends ConsumerWidget {
|
|||
: l10n.page(chapter.lastPageRead!),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: isLight(context)
|
||||
color: context.isLight
|
||||
? Colors.black.withOpacity(0.4)
|
||||
: Colors.white.withOpacity(0.3)),
|
||||
),
|
||||
|
|
@ -114,7 +113,7 @@ class ChapterListTileWidget extends ConsumerWidget {
|
|||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: chapter.isRead!
|
||||
? isLight(context)
|
||||
? context.isLight
|
||||
? Colors.black.withOpacity(0.4)
|
||||
: Colors.white.withOpacity(0.3)
|
||||
: null),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class CustomFloatingActionBtn extends StatelessWidget {
|
||||
final bool isExtended;
|
||||
|
|
@ -24,7 +24,7 @@ class CustomFloatingActionBtn extends StatelessWidget {
|
|||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.easeIn,
|
||||
child: FloatingActionButton(
|
||||
backgroundColor: primaryColor(context),
|
||||
backgroundColor: context.primaryColor,
|
||||
onPressed: onPressed,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import 'package:expandable_text/expandable_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class ReadMoreWidget extends StatefulWidget {
|
||||
const ReadMoreWidget({super.key, required this.text, required this.onChanged});
|
||||
const ReadMoreWidget(
|
||||
{super.key, required this.text, required this.onChanged});
|
||||
final Function(bool) onChanged;
|
||||
final String text;
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ class ReadMoreWidgetState extends State<ReadMoreWidget>
|
|||
right: 0,
|
||||
left: 0,
|
||||
child: Container(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
|
|
@ -77,7 +78,7 @@ class ReadMoreWidgetState extends State<ReadMoreWidget>
|
|||
),
|
||||
if (expanded)
|
||||
SizedBox(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: 20,
|
||||
child: const Icon(Icons.keyboard_arrow_up_sharp),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ import 'package:mangayomi/models/track.dart';
|
|||
import 'package:mangayomi/models/track_search.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/providers/track_state_providers.dart';
|
||||
import 'package:mangayomi/modules/widgets/progress_center.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class TrackerWidgetSearch extends ConsumerStatefulWidget {
|
||||
final bool isManga;
|
||||
|
|
@ -56,7 +55,7 @@ class _TrackerWidgetSearchState extends ConsumerState<TrackerWidgetSearch> {
|
|||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: SizedBox(
|
||||
height: mediaHeight(context, 0.8),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: Column(
|
||||
children: [
|
||||
Flexible(
|
||||
|
|
@ -97,7 +96,7 @@ class _TrackerWidgetSearchState extends ConsumerState<TrackerWidgetSearch> {
|
|||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: mediaWidth(context, 0.6),
|
||||
width: context.mediaWidth(0.6),
|
||||
child: Text(
|
||||
tracks![index].title!,
|
||||
style: const TextStyle(
|
||||
|
|
@ -196,15 +195,15 @@ class _TrackerWidgetSearchState extends ConsumerState<TrackerWidgetSearch> {
|
|||
icon: const Icon(Icons.clear)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: primaryColor(context)),
|
||||
BorderSide(color: context.primaryColor),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: primaryColor(context)),
|
||||
BorderSide(color: context.primaryColor),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: primaryColor(context)))),
|
||||
BorderSide(color: context.primaryColor))),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ import 'package:mangayomi/modules/manga/detail/providers/track_state_providers.d
|
|||
import 'package:mangayomi/modules/manga/detail/widgets/tracker_search_widget.dart';
|
||||
import 'package:mangayomi/modules/more/settings/track/providers/track_providers.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
import 'package:mangayomi/utils/date.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/utils.dart';
|
||||
import 'package:numberpicker/numberpicker.dart';
|
||||
|
||||
class TrackerWidget extends ConsumerStatefulWidget {
|
||||
|
|
@ -58,7 +56,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
final l10nLocale = ref.watch(l10nLocaleStateProvider);
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: isLight(context)
|
||||
color: context.isLight
|
||||
? Theme.of(context).scaffoldBackgroundColor
|
||||
: Colors.black,
|
||||
borderRadius: BorderRadius.circular(20)),
|
||||
|
|
@ -68,7 +66,8 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
children: [
|
||||
if (!widget.hide)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 5),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
|
|
@ -148,7 +147,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
l10n!.status,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: ref
|
||||
|
|
@ -199,7 +198,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -254,7 +253,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
|
|
@ -271,7 +270,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
child: Text(
|
||||
l10n.ok,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -341,7 +340,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
|
|
@ -357,7 +356,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
child: Text(
|
||||
l10n.ok,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -456,14 +455,14 @@ Widget _elevatedButton(BuildContext context,
|
|||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.all(0),
|
||||
backgroundColor: isLight(context)
|
||||
backgroundColor: context.isLight
|
||||
? Theme.of(context).scaffoldBackgroundColor
|
||||
: Colors.black,
|
||||
elevation: 0,
|
||||
shadowColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
width: 0, color: secondaryColor(context).withOpacity(0.1)),
|
||||
width: 0, color: context.secondaryColor.withOpacity(0.1)),
|
||||
borderRadius: borderRadius ?? BorderRadius.circular(0))),
|
||||
onPressed: onPressed,
|
||||
child: child ??
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import 'package:mangayomi/modules/more/settings/downloads/providers/downloads_st
|
|||
import 'package:mangayomi/providers/storage_provider.dart';
|
||||
import 'package:mangayomi/services/get_video_list.dart';
|
||||
import 'package:mangayomi/services/get_chapter_pages.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/utils/headers.dart';
|
||||
import 'package:mangayomi/utils/reg_exp_matcher.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ import 'package:mangayomi/services/get_latest_updates.dart';
|
|||
import 'package:mangayomi/services/get_popular.dart';
|
||||
import 'package:mangayomi/services/search.dart';
|
||||
import 'package:mangayomi/services/supports_latest.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/modules/library/widgets/search_text_form_field.dart';
|
||||
import 'package:mangayomi/modules/manga/home/widget/mangas_card_selector.dart';
|
||||
import 'package:mangayomi/modules/widgets/gridview_widget.dart';
|
||||
|
|
@ -192,7 +191,7 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
icon: Icon(
|
||||
Icons.public,
|
||||
size: 22,
|
||||
color: secondaryColor(context),
|
||||
color: context.secondaryColor,
|
||||
),
|
||||
)
|
||||
],
|
||||
|
|
@ -201,7 +200,7 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: 45,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
|
|
@ -247,7 +246,7 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
primaryColor(context)),
|
||||
context.primaryColor),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, 'filter');
|
||||
},
|
||||
|
|
@ -305,9 +304,9 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
),
|
||||
),
|
||||
Container(
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
height: 0.3,
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
@ -339,7 +338,7 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
),
|
||||
),
|
||||
)
|
||||
: isTablet(context)
|
||||
: context.isTablet
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: ElevatedButton(
|
||||
|
|
@ -491,7 +490,7 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
icon: Icon(
|
||||
Icons.public,
|
||||
size: 22,
|
||||
color: secondaryColor(context),
|
||||
color: context.secondaryColor,
|
||||
),
|
||||
),
|
||||
const Text("Webview")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:mangayomi/eval/model/filter.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class FilterWidget extends StatelessWidget {
|
||||
final List<dynamic> filterList;
|
||||
|
|
@ -106,7 +105,7 @@ class FilterWidget extends StatelessWidget {
|
|||
);
|
||||
} else if (filterState is SelectFilter) {
|
||||
widget = SizedBox(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
|
@ -181,10 +180,10 @@ class _SeachFormTextFieldWidgetState extends State<SeachFormTextFieldWidget> {
|
|||
isDense: true,
|
||||
filled: false,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: secondaryColor(context)),
|
||||
borderSide: BorderSide(color: context.secondaryColor),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor(context)),
|
||||
borderSide: BorderSide(color: context.primaryColor),
|
||||
),
|
||||
border: const OutlineInputBorder(borderSide: BorderSide()),
|
||||
labelText: widget.labelText,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class MangasCardSelector extends StatelessWidget {
|
||||
final String text;
|
||||
|
|
@ -20,8 +20,8 @@ class MangasCardSelector extends StatelessWidget {
|
|||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.all(0),
|
||||
side: BorderSide(width: 0.6, color: primaryColor(context)),
|
||||
backgroundColor: selected ? primaryColor(context) : null,
|
||||
side: BorderSide(width: 0.6, color: context.primaryColor),
|
||||
backgroundColor: selected ? context.primaryColor : null,
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(7)),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ import 'package:mangayomi/modules/manga/reader/reader_view.dart';
|
|||
import 'package:mangayomi/modules/manga/reader/widgets/circular_progress_indicator_animate_rotate.dart';
|
||||
import 'package:mangayomi/modules/more/settings/reader/reader_screen.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
import 'package:photo_view/photo_view_gallery.dart';
|
||||
|
||||
|
|
@ -137,14 +136,12 @@ class _DoubleColummViewState extends State<DoubleColummView>
|
|||
state.loadingProgress;
|
||||
final double progress =
|
||||
loadingProgress?.expectedTotalBytes != null
|
||||
? loadingProgress!
|
||||
.cumulativeBytesLoaded /
|
||||
? loadingProgress!.cumulativeBytesLoaded /
|
||||
loadingProgress.expectedTotalBytes!
|
||||
: 0;
|
||||
return Container(
|
||||
color: getBackgroundColor(
|
||||
widget.backgroundColor),
|
||||
height: mediaHeight(context, 0.8),
|
||||
color: getBackgroundColor(widget.backgroundColor),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: CircularProgressIndicatorAnimateRotate(
|
||||
progress: progress),
|
||||
);
|
||||
|
|
@ -158,44 +155,38 @@ class _DoubleColummViewState extends State<DoubleColummView>
|
|||
LoadState.failed) {
|
||||
widget.isFailedToLoadImage(true);
|
||||
return Container(
|
||||
color: getBackgroundColor(
|
||||
widget.backgroundColor),
|
||||
height: mediaHeight(context, 0.8),
|
||||
color:
|
||||
getBackgroundColor(widget.backgroundColor),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
l10n.image_loading_error,
|
||||
style: TextStyle(
|
||||
color: Colors.white
|
||||
.withOpacity(0.7)),
|
||||
color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: GestureDetector(
|
||||
onLongPress: () {
|
||||
state.reLoadImage();
|
||||
widget
|
||||
.isFailedToLoadImage(false);
|
||||
widget.isFailedToLoadImage(false);
|
||||
},
|
||||
onTap: () {
|
||||
state.reLoadImage();
|
||||
widget
|
||||
.isFailedToLoadImage(false);
|
||||
widget.isFailedToLoadImage(false);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
30)),
|
||||
BorderRadius.circular(30)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets
|
||||
.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 16),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 16),
|
||||
child: Text(
|
||||
l10n.retry,
|
||||
),
|
||||
|
|
@ -222,14 +213,12 @@ class _DoubleColummViewState extends State<DoubleColummView>
|
|||
state.loadingProgress;
|
||||
final double progress =
|
||||
loadingProgress?.expectedTotalBytes != null
|
||||
? loadingProgress!
|
||||
.cumulativeBytesLoaded /
|
||||
? loadingProgress!.cumulativeBytesLoaded /
|
||||
loadingProgress.expectedTotalBytes!
|
||||
: 0;
|
||||
return Container(
|
||||
color: getBackgroundColor(
|
||||
widget.backgroundColor),
|
||||
height: mediaHeight(context, 0.8),
|
||||
color: getBackgroundColor(widget.backgroundColor),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: CircularProgressIndicatorAnimateRotate(
|
||||
progress: progress),
|
||||
);
|
||||
|
|
@ -243,44 +232,38 @@ class _DoubleColummViewState extends State<DoubleColummView>
|
|||
LoadState.failed) {
|
||||
widget.isFailedToLoadImage(true);
|
||||
return Container(
|
||||
color: getBackgroundColor(
|
||||
widget.backgroundColor),
|
||||
height: mediaHeight(context, 0.8),
|
||||
color:
|
||||
getBackgroundColor(widget.backgroundColor),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
l10n.image_loading_error,
|
||||
style: TextStyle(
|
||||
color: Colors.white
|
||||
.withOpacity(0.7)),
|
||||
color: Colors.white.withOpacity(0.7)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: GestureDetector(
|
||||
onLongPress: () {
|
||||
state.reLoadImage();
|
||||
widget
|
||||
.isFailedToLoadImage(false);
|
||||
widget.isFailedToLoadImage(false);
|
||||
},
|
||||
onTap: () {
|
||||
state.reLoadImage();
|
||||
widget
|
||||
.isFailedToLoadImage(false);
|
||||
widget.isFailedToLoadImage(false);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
30)),
|
||||
BorderRadius.circular(30)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets
|
||||
.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 16),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 16),
|
||||
child: Text(
|
||||
l10n.retry,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ import 'package:mangayomi/modules/manga/reader/reader_view.dart';
|
|||
import 'package:mangayomi/modules/manga/reader/widgets/circular_progress_indicator_animate_rotate.dart';
|
||||
import 'package:mangayomi/modules/more/settings/reader/reader_screen.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class DoubleColummVerticalView extends StatelessWidget {
|
||||
final bool cropBorders;
|
||||
|
|
@ -51,7 +50,7 @@ class DoubleColummVerticalView extends StatelessWidget {
|
|||
: 0;
|
||||
return Container(
|
||||
color: getBackgroundColor(backgroundColor),
|
||||
height: mediaHeight(context, 0.8),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: CircularProgressIndicatorAnimateRotate(
|
||||
progress: progress),
|
||||
);
|
||||
|
|
@ -64,7 +63,7 @@ class DoubleColummVerticalView extends StatelessWidget {
|
|||
isFailedToLoadImage(true);
|
||||
return Container(
|
||||
color: getBackgroundColor(backgroundColor),
|
||||
height: mediaHeight(context, 0.8),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
|
@ -86,7 +85,7 @@ class DoubleColummVerticalView extends StatelessWidget {
|
|||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(30)),
|
||||
child: Padding(
|
||||
|
|
@ -122,7 +121,7 @@ class DoubleColummVerticalView extends StatelessWidget {
|
|||
: 0;
|
||||
return Container(
|
||||
color: getBackgroundColor(backgroundColor),
|
||||
height: mediaHeight(context, 0.8),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: CircularProgressIndicatorAnimateRotate(
|
||||
progress: progress),
|
||||
);
|
||||
|
|
@ -135,7 +134,7 @@ class DoubleColummVerticalView extends StatelessWidget {
|
|||
isFailedToLoadImage(true);
|
||||
return Container(
|
||||
color: getBackgroundColor(backgroundColor),
|
||||
height: mediaHeight(context, 0.8),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
|
@ -157,7 +156,7 @@ class DoubleColummVerticalView extends StatelessWidget {
|
|||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(30)),
|
||||
child: Padding(
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@ import 'package:mangayomi/modules/manga/reader/providers/reader_controller_provi
|
|||
import 'package:mangayomi/modules/manga/reader/reader_view.dart';
|
||||
import 'package:mangayomi/modules/more/settings/reader/providers/reader_state_provider.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/headers.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/reg_exp_matcher.dart';
|
||||
import 'package:mangayomi/modules/manga/reader/widgets/circular_progress_indicator_animate_rotate.dart';
|
||||
|
||||
|
|
@ -75,7 +74,7 @@ class ImageViewVertical extends ConsumerWidget {
|
|||
: 0;
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
height: mediaHeight(context, 0.8),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: CircularProgressIndicatorAnimateRotate(
|
||||
progress: progress),
|
||||
);
|
||||
|
|
@ -84,7 +83,7 @@ class ImageViewVertical extends ConsumerWidget {
|
|||
failedToLoadImage(true);
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
height: mediaHeight(context, 0.8),
|
||||
height: context.mediaHeight(0.8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
|
@ -104,7 +103,7 @@ class ImageViewVertical extends ConsumerWidget {
|
|||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
borderRadius: BorderRadius.circular(30)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@ import 'package:mangayomi/providers/l10n_providers.dart';
|
|||
import 'package:mangayomi/sources/utils/utils.dart';
|
||||
import 'package:mangayomi/modules/manga/reader/providers/push_router.dart';
|
||||
import 'package:mangayomi/services/get_chapter_pages.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/headers.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/modules/manga/reader/image_view_center.dart';
|
||||
import 'package:mangayomi/modules/manga/reader/image_view_vertical.dart';
|
||||
import 'package:mangayomi/modules/manga/reader/providers/reader_controller_provider.dart';
|
||||
|
|
@ -364,7 +363,7 @@ class _MangaChapterPageGalleryState
|
|||
onScaleEnd: _onScaleEnd,
|
||||
child: ScrollablePositionedList.separated(
|
||||
minCacheExtent: pagePreloadAmount *
|
||||
mediaHeight(context, 1),
|
||||
context.mediaHeight(1),
|
||||
initialScrollIndex:
|
||||
_readerController.getPageIndex(),
|
||||
itemCount:
|
||||
|
|
@ -514,7 +513,7 @@ class _MangaChapterPageGalleryState
|
|||
return Container(
|
||||
color: getBackgroundColor(
|
||||
backgroundColor),
|
||||
height: mediaHeight(context, 0.8),
|
||||
height: context.mediaHeight(0.8),
|
||||
child:
|
||||
CircularProgressIndicatorAnimateRotate(
|
||||
progress: progress),
|
||||
|
|
@ -560,7 +559,7 @@ class _MangaChapterPageGalleryState
|
|||
color: getBackgroundColor(
|
||||
backgroundColor),
|
||||
height:
|
||||
mediaHeight(context, 0.8),
|
||||
context.mediaHeight(0.8),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
|
|
@ -589,9 +588,8 @@ class _MangaChapterPageGalleryState
|
|||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
primaryColor(
|
||||
context),
|
||||
color: context
|
||||
.primaryColor,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
|
|
@ -1150,7 +1148,7 @@ class _MangaChapterPageGalleryState
|
|||
return Positioned(
|
||||
top: 0,
|
||||
child: AnimatedContainer(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: _isView
|
||||
? Platform.isIOS
|
||||
? 120
|
||||
|
|
@ -1176,7 +1174,7 @@ class _MangaChapterPageGalleryState
|
|||
title: ListTile(
|
||||
dense: true,
|
||||
title: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: Text(
|
||||
'${_readerController.getMangaName()} ',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
|
|
@ -1184,7 +1182,7 @@ class _MangaChapterPageGalleryState
|
|||
),
|
||||
),
|
||||
subtitle: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: Text(
|
||||
_readerController.getChapterTitle(),
|
||||
style: const TextStyle(
|
||||
|
|
@ -1265,7 +1263,7 @@ class _MangaChapterPageGalleryState
|
|||
child: AnimatedContainer(
|
||||
curve: Curves.ease,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: (_isView ? 130 : 0),
|
||||
child: Column(
|
||||
children: [
|
||||
|
|
@ -1691,8 +1689,8 @@ class _MangaChapterPageGalleryState
|
|||
flex: 2,
|
||||
child: failedToLoadImage
|
||||
? SizedBox(
|
||||
width: mediaWidth(context, 1),
|
||||
height: mediaHeight(context, 0.7),
|
||||
width: context.mediaWidth(1),
|
||||
height: context.mediaHeight(0.7),
|
||||
)
|
||||
: GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/modules/browse/extension/providers/fetch_manga_sources.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ import 'package:mangayomi/modules/more/backup_and_restore/providers/auto_backup.
|
|||
import 'package:mangayomi/modules/more/backup_and_restore/providers/backup.dart';
|
||||
import 'package:mangayomi/modules/more/backup_and_restore/providers/restore.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class BackupAndRestore extends ConsumerWidget {
|
||||
const BackupAndRestore({super.key});
|
||||
|
|
@ -42,7 +41,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
return AlertDialog(
|
||||
title: Text(l10n.create_backup_dialog_title),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: list.length,
|
||||
|
|
@ -74,13 +73,13 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
final result = await FilePicker.platform
|
||||
.getDirectoryPath();
|
||||
|
||||
|
||||
if (result != null && context.mounted) {
|
||||
ref.watch(doBackUpProvider(
|
||||
list: indexList,
|
||||
|
|
@ -91,7 +90,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.ok,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -104,7 +103,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
title: Text(l10n.create_backup),
|
||||
subtitle: Text(
|
||||
l10n.create_backup_subtitle,
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -115,20 +114,21 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
return AlertDialog(
|
||||
title: Text(l10n.restore_backup),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline_rounded,
|
||||
color: secondaryColor(context)),
|
||||
color: context.secondaryColor),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 5),
|
||||
child: Text(l10n.restore_backup_warning_title),
|
||||
child:
|
||||
Text(l10n.restore_backup_warning_title),
|
||||
),
|
||||
],
|
||||
)),
|
||||
|
|
@ -143,15 +143,15 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
try {
|
||||
FilePickerResult? result = await FilePicker
|
||||
.platform
|
||||
.pickFiles(allowMultiple: false);
|
||||
|
||||
FilePickerResult? result =
|
||||
await FilePicker.platform
|
||||
.pickFiles(allowMultiple: false);
|
||||
|
||||
if (result != null && context.mounted) {
|
||||
ref.watch(doRestoreProvider(
|
||||
path: result.files.first.path!,
|
||||
|
|
@ -167,7 +167,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.ok,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -178,7 +178,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
title: Text(l10n.restore_backup),
|
||||
subtitle: Text(
|
||||
l10n.restore_backup_subtitle,
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
|
|
@ -187,7 +187,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
children: [
|
||||
Text(l10n.automatic_backups,
|
||||
style:
|
||||
TextStyle(fontSize: 13, color: primaryColor(context))),
|
||||
TextStyle(fontSize: 13, color: context.primaryColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -200,7 +200,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
return AlertDialog(
|
||||
title: Text(l10n.backup_frequency),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: list.length,
|
||||
|
|
@ -212,8 +212,8 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
groupValue: backupFrequency,
|
||||
onChanged: (value) {
|
||||
ref
|
||||
.read(
|
||||
backupFrequencyStateProvider.notifier)
|
||||
.read(backupFrequencyStateProvider
|
||||
.notifier)
|
||||
.set(value!);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
|
|
@ -234,7 +234,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -245,16 +245,18 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
title: Text(l10n.backup_frequency),
|
||||
subtitle: Text(
|
||||
_getBackupFrequencyList(context)[backupFrequency],
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
// if (!isIOS)
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
String? result = await FilePicker.platform.getDirectoryPath();
|
||||
|
||||
|
||||
if (result != null) {
|
||||
ref.read(autoBackupLocationStateProvider.notifier).set(result);
|
||||
ref
|
||||
.read(autoBackupLocationStateProvider.notifier)
|
||||
.set(result);
|
||||
}
|
||||
},
|
||||
title: Text(l10n.backup_location),
|
||||
|
|
@ -262,7 +264,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
autoBackupLocation.$2.isEmpty
|
||||
? autoBackupLocation.$1
|
||||
: autoBackupLocation.$2,
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -280,7 +282,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
l10n.backup_options_subtitle,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: list.length,
|
||||
|
|
@ -312,7 +314,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
|
|
@ -326,7 +328,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.ok,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -339,7 +341,7 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
title: Text(l10n.backup_options),
|
||||
subtitle: Text(
|
||||
l10n.backup_options_subtitle,
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -348,12 +350,13 @@ class BackupAndRestore extends ConsumerWidget {
|
|||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline_rounded,
|
||||
color: secondaryColor(context)),
|
||||
color: context.secondaryColor),
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: Text(l10n.backup_and_restore_warning_info,
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context))),
|
||||
style:
|
||||
TextStyle(fontSize: 11, color: context.secondaryColor)),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import 'package:mangayomi/models/settings.dart';
|
|||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/models/track.dart';
|
||||
import 'package:mangayomi/models/track_preference.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
part 'backup.g.dart';
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/modules/more/settings/appearance/providers/theme_mode_state_provider.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/date.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/modules/more/settings/appearance/providers/date_format_state_provider.dart';
|
||||
import 'package:mangayomi/modules/more/settings/appearance/providers/pure_black_dark_mode_state_provider.dart';
|
||||
import 'package:mangayomi/modules/more/settings/appearance/widgets/blend_level_slider.dart';
|
||||
|
|
@ -38,7 +37,7 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
children: [
|
||||
Text(l10n.theme,
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: primaryColor(context))),
|
||||
fontSize: 13, color: context.primaryColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -71,7 +70,7 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
children: [
|
||||
Text(l10n.timestamp,
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: primaryColor(context))),
|
||||
fontSize: 13, color: context.primaryColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -85,7 +84,7 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
l10n.relative_timestamp,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount:
|
||||
|
|
@ -124,7 +123,7 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -136,7 +135,7 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
subtitle: Text(
|
||||
relativeTimestampsList(context)[relativeTimestamps],
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context)),
|
||||
fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -149,7 +148,7 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
l10n.date_format,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: dateFormatsList.length,
|
||||
|
|
@ -186,7 +185,7 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -198,7 +197,7 @@ class AppearanceScreen extends ConsumerWidget {
|
|||
subtitle: Text(
|
||||
"$dateFormatState (${dateFormat(context: context, DateTime.now().millisecondsSinceEpoch.toString(), useRelativeTimesTamps: false, dateFormat: dateFormatState, ref: ref)})",
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context)),
|
||||
fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/modules/more/settings/appearance/providers/theme_mode_state_provider.dart';
|
||||
// import 'package:rive/rive.dart';
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ class _DarkModeButtonState extends ConsumerState<DarkModeButton> {
|
|||
title: Text(l10n!.dark_mode),
|
||||
subtitle: Text(
|
||||
!isDark ? l10n.off : l10n.on,
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
value: isDark,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:mangayomi/main.dart';
|
||||
import 'package:mangayomi/models/settings.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/modules/more/settings/appearance/providers/flex_scheme_color_state_provider.dart';
|
||||
|
||||
class ThemeSelector extends ConsumerStatefulWidget {
|
||||
|
|
@ -96,7 +96,7 @@ class _ThemeSelectorState extends ConsumerState<ThemeSelector> {
|
|||
backgroundColor: theme.primaryColorLight,
|
||||
child: Icon(
|
||||
FontAwesomeIcons.check,
|
||||
color: secondaryColor(context),
|
||||
color: context.secondaryColor,
|
||||
size: 16,
|
||||
)),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/modules/more/settings/browse/providers/browse_state_provider.dart';
|
||||
|
||||
class BrowseSScreen extends ConsumerWidget {
|
||||
|
|
@ -33,7 +33,7 @@ class BrowseSScreen extends ConsumerWidget {
|
|||
children: [
|
||||
Text(l10n.extensions,
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: primaryColor(context))),
|
||||
fontSize: 13, color: context.primaryColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -52,7 +52,7 @@ class BrowseSScreen extends ConsumerWidget {
|
|||
subtitle: Text(
|
||||
l10n.auto_extensions_updates_subtitle,
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context))),
|
||||
fontSize: 11, color: context.secondaryColor)),
|
||||
onChanged: (value) {
|
||||
ref
|
||||
.read(autoUpdateExtensionsStateProvider.notifier)
|
||||
|
|
@ -71,7 +71,7 @@ class BrowseSScreen extends ConsumerWidget {
|
|||
children: [
|
||||
Text(l10n.global_search,
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: primaryColor(context))),
|
||||
fontSize: 13, color: context.primaryColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -96,7 +96,7 @@ class BrowseSScreen extends ConsumerWidget {
|
|||
children: [
|
||||
Text(l10n.nsfw_sources,
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: primaryColor(context))),
|
||||
fontSize: 13, color: context.primaryColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -113,14 +113,14 @@ class BrowseSScreen extends ConsumerWidget {
|
|||
children: [
|
||||
Icon(
|
||||
Icons.info_outline_rounded,
|
||||
color: secondaryColor(context),
|
||||
color: context.secondaryColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: Text(l10n.nsfw_sources_info,
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context))),
|
||||
fontSize: 11, color: context.secondaryColor)),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/modules/more/settings/downloads/providers/downloads_state_provider.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class DownloadsScreen extends ConsumerStatefulWidget {
|
||||
const DownloadsScreen({super.key});
|
||||
|
|
@ -38,7 +37,7 @@ class _DownloadsScreenState extends ConsumerState<DownloadsScreen> {
|
|||
return AlertDialog(
|
||||
title: Text(l10n.download_location),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
|
|
@ -91,7 +90,7 @@ class _DownloadsScreenState extends ConsumerState<DownloadsScreen> {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -104,7 +103,7 @@ class _DownloadsScreenState extends ConsumerState<DownloadsScreen> {
|
|||
downloadLocationState.$2.isEmpty
|
||||
? downloadLocationState.$1
|
||||
: downloadLocationState.$2,
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
SwitchListTile(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/language.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class GeneralScreen extends ConsumerWidget {
|
||||
|
|
@ -30,10 +29,11 @@ class GeneralScreen extends ConsumerWidget {
|
|||
l10n.app_language,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: AppLocalizations.supportedLocales.length,
|
||||
itemCount:
|
||||
AppLocalizations.supportedLocales.length,
|
||||
itemBuilder: (context, index) {
|
||||
final locale =
|
||||
AppLocalizations.supportedLocales[index];
|
||||
|
|
@ -64,7 +64,7 @@ class GeneralScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -75,7 +75,7 @@ class GeneralScreen extends ConsumerWidget {
|
|||
title: Text(l10n.app_language),
|
||||
subtitle: Text(
|
||||
completeLanguageName(l10nLocale.toLanguageTag()),
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/modules/more/settings/player/providers/player_state_provider.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:numberpicker/numberpicker.dart';
|
||||
|
||||
class PlayerScreen extends ConsumerWidget {
|
||||
|
|
@ -35,7 +34,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
return AlertDialog(
|
||||
title: Text(context.l10n.markEpisodeAsSeenSetting),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: values.length,
|
||||
|
|
@ -69,7 +68,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -80,7 +79,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.markEpisodeAsSeenSetting),
|
||||
subtitle: Text(
|
||||
"$markEpisodeAsSeenType%",
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -122,7 +121,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
|
|
@ -136,7 +135,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.ok,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -147,7 +146,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.default_skip_intro_length),
|
||||
subtitle: Text(
|
||||
"${defaultSkipIntroLength}s",
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -160,7 +159,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
title:
|
||||
Text(context.l10n.default_skip_forward_skip_length),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: values.length,
|
||||
|
|
@ -195,7 +194,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -206,7 +205,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.default_skip_forward_skip_length),
|
||||
subtitle: Text(
|
||||
"${defaultDoubleTapToSkipLength}s",
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -218,7 +217,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
return AlertDialog(
|
||||
title: Text(context.l10n.default_playback_speed_length),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: values.length,
|
||||
|
|
@ -252,7 +251,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -263,7 +262,7 @@ class PlayerScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.default_playback_speed_length),
|
||||
subtitle: Text(
|
||||
"x$defaultPlayBackSpeed",
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/models/settings.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/modules/more/settings/reader/providers/reader_state_provider.dart';
|
||||
|
||||
class ReaderScreen extends ConsumerWidget {
|
||||
|
|
@ -36,7 +35,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
return AlertDialog(
|
||||
title: Text(context.l10n.default_reading_mode),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: ReaderMode.values.length,
|
||||
|
|
@ -73,7 +72,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -84,7 +83,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.default_reading_mode),
|
||||
subtitle: Text(
|
||||
getReaderModeName(defaultReadingMode, context),
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -97,7 +96,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
context.l10n.double_tap_animation_speed,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: 3,
|
||||
|
|
@ -135,7 +134,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -146,7 +145,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.double_tap_animation_speed),
|
||||
subtitle: Text(
|
||||
getAnimationSpeedName(doubleTapAnimationSpeed, context),
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -157,7 +156,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
return AlertDialog(
|
||||
title: Text(context.l10n.background_color),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: BackgroundColor.values.length,
|
||||
|
|
@ -195,7 +194,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -206,7 +205,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.background_color),
|
||||
subtitle: Text(
|
||||
getBackgroundColorName(backgroundColor, context),
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -220,7 +219,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
context.l10n.page_preload_amount,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: numbers.length,
|
||||
|
|
@ -254,7 +253,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -265,7 +264,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.page_preload_amount),
|
||||
subtitle: Text(
|
||||
context.l10n.page_preload_amount_subtitle,
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -278,7 +277,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
context.l10n.scale_type,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
width: context.mediaWidth(0.8),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: getScaleTypeNames(context).length,
|
||||
|
|
@ -314,7 +313,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
child: Text(
|
||||
context.l10n.cancel,
|
||||
style:
|
||||
TextStyle(color: primaryColor(context)),
|
||||
TextStyle(color: context.primaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
@ -325,7 +324,7 @@ class ReaderScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.scale_type),
|
||||
subtitle: Text(
|
||||
getScaleTypeNames(context)[scaleType.index],
|
||||
style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
),
|
||||
),
|
||||
SwitchListTile(
|
||||
|
|
@ -386,7 +385,6 @@ Color? getBackgroundColor(BackgroundColor backgroundColor) {
|
|||
}
|
||||
|
||||
String getAnimationSpeedName(int type, BuildContext context) {
|
||||
|
||||
return switch (type) {
|
||||
0 => context.l10n.no_animation,
|
||||
1 => context.l10n.normal,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import 'package:mangayomi/models/track_preference.dart';
|
|||
import 'package:mangayomi/modules/widgets/gridview_widget.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class ManageTrackersScreen extends StatefulWidget {
|
||||
const ManageTrackersScreen({super.key});
|
||||
|
|
@ -55,7 +55,7 @@ class _ManageTrackersScreenState extends State<ManageTrackersScreen> {
|
|||
borderRadius: BorderRadius.circular(10)),
|
||||
child: trackerPref.syncId == -1
|
||||
? SizedBox(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
child: const Icon(Icons.local_library_rounded,
|
||||
size: 60))
|
||||
: Image.asset(
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@ import 'package:mangayomi/providers/l10n_providers.dart';
|
|||
import 'package:mangayomi/services/trackers/anilist.dart';
|
||||
import 'package:mangayomi/services/trackers/kitsu.dart';
|
||||
import 'package:mangayomi/services/trackers/myanimelist.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class TrackScreen extends ConsumerWidget {
|
||||
const TrackScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final updateProgressAfterReading = ref.watch(updateProgressAfterReadingStateProvider);
|
||||
final updateProgressAfterReading =
|
||||
ref.watch(updateProgressAfterReadingStateProvider);
|
||||
final l10n = l10nLocalizations(context)!;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
|
@ -41,7 +41,8 @@ class TrackScreen extends ConsumerWidget {
|
|||
title: Text(context.l10n.updateProgressAfterReading),
|
||||
onChanged: (value) {
|
||||
ref
|
||||
.read(updateProgressAfterReadingStateProvider.notifier)
|
||||
.read(updateProgressAfterReadingStateProvider
|
||||
.notifier)
|
||||
.set(value);
|
||||
}),
|
||||
Padding(
|
||||
|
|
@ -51,7 +52,7 @@ class TrackScreen extends ConsumerWidget {
|
|||
children: [
|
||||
Text(l10n.services,
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: primaryColor(context))),
|
||||
fontSize: 13, color: context.primaryColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -85,14 +86,14 @@ class TrackScreen extends ConsumerWidget {
|
|||
children: [
|
||||
Icon(
|
||||
Icons.info_outline_rounded,
|
||||
color: secondaryColor(context),
|
||||
color: context.secondaryColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: Text(l10n.tracking_warning_info,
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: secondaryColor(context))),
|
||||
fontSize: 11, color: context.secondaryColor)),
|
||||
),
|
||||
ListTileWidget(
|
||||
title: l10n.manage_trackers,
|
||||
|
|
@ -188,7 +189,7 @@ void _showDialogLogin(BuildContext context, WidgetRef ref) {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: SizedBox(
|
||||
width: mediaWidth(context, 1),
|
||||
width: context.mediaWidth(1),
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
onPressed: isLoading
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:mangayomi/models/track_preference.dart';
|
||||
import 'package:mangayomi/modules/more/settings/track/providers/track_providers.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
|
||||
class TrackListile extends ConsumerWidget {
|
||||
|
|
@ -63,7 +63,7 @@ class TrackListile extends ConsumerWidget {
|
|||
surfaceTintColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: secondaryColor(context)),
|
||||
color: context.secondaryColor),
|
||||
borderRadius:
|
||||
BorderRadius.circular(20))),
|
||||
onPressed: () {
|
||||
|
|
@ -72,7 +72,7 @@ class TrackListile extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: secondaryColor(context)),
|
||||
color: context.secondaryColor),
|
||||
)),
|
||||
const SizedBox(width: 15),
|
||||
ElevatedButton(
|
||||
|
|
@ -89,7 +89,7 @@ class TrackListile extends ConsumerWidget {
|
|||
child: Text(
|
||||
l10n.log_out,
|
||||
style: TextStyle(
|
||||
color: secondaryColor(context)),
|
||||
color: context.secondaryColor),
|
||||
)),
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class ListTileWidget extends StatelessWidget {
|
||||
final VoidCallback onTap;
|
||||
|
|
@ -22,14 +22,14 @@ class ListTileWidget extends StatelessWidget {
|
|||
// subtitle: subtitle != null
|
||||
// ? Text(
|
||||
// subtitle!,
|
||||
// style: TextStyle(fontSize: 11, color: secondaryColor(context)),
|
||||
// style: TextStyle(fontSize: 11, color: context.secondaryColor),
|
||||
// )
|
||||
// : null,
|
||||
leading: SizedBox(
|
||||
height: 40,
|
||||
child: Icon(
|
||||
icon,
|
||||
color: primaryColor(context),
|
||||
color: context.primaryColor,
|
||||
)),
|
||||
title: Text(title),
|
||||
trailing: trailing,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class BottomTextWidget extends StatelessWidget {
|
||||
final bool isLoading;
|
||||
|
|
@ -30,7 +30,7 @@ class BottomTextWidget extends StatelessWidget {
|
|||
style: TextStyle(
|
||||
fontSize: fontSize,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: textColor ?? primaryColor(context),
|
||||
color: textColor ?? context.primaryColor,
|
||||
),
|
||||
maxLines: maxLines,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
|
||||
class CoverViewWidget extends StatelessWidget {
|
||||
final List<Widget> children;
|
||||
|
|
@ -35,7 +35,7 @@ class CoverViewWidget extends StatelessWidget {
|
|||
onLongPress: onLongPress,
|
||||
child: Container(
|
||||
color: isLongPressed != null && isLongPressed!
|
||||
? primaryColor(context).withOpacity(0.4)
|
||||
? context.primaryColor.withOpacity(0.4)
|
||||
: Colors.transparent,
|
||||
child: image == null
|
||||
? isComfortableGrid
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import 'package:mangayomi/models/settings.dart';
|
|||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/manga_detail_main.dart';
|
||||
import 'package:mangayomi/router/router.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
import 'package:mangayomi/utils/headers.dart';
|
||||
import 'package:mangayomi/modules/widgets/bottom_text_widget.dart';
|
||||
|
|
@ -75,7 +75,7 @@ class MangaImageCardWidget extends ConsumerWidget {
|
|||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Icon(Icons.collections_bookmark,
|
||||
color: primaryColor(context)),
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
BottomTextWidget(text: getMangaDetail!.name!)
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:math';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
|
||||
class DoodExtractor {
|
||||
Future<List<Video>> videosFromUrl(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:js_packer/js_packer.dart';
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/utils/xpath_selector.dart';
|
||||
|
||||
class FilemoonExtractor {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import 'package:http/http.dart' as http;
|
|||
import 'package:mangayomi/eval/model/m_bridge.dart';
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:html/parser.dart' as parser;
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
|
||||
class GogoCdnExtractor {
|
||||
final http.Client client = http.Client();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:js_packer/js_packer.dart';
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/utils/xpath_selector.dart';
|
||||
|
||||
class Mp4uploadExtractor {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
|
||||
class MyStreamExtractor {
|
||||
Future<List<Video>> videosFromUrl(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:html/parser.dart' show parse;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
|
||||
class MytvExtractor {
|
||||
final http.Client client = http.Client();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:html/parser.dart' show parse;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
|
||||
class OkruExtractor {
|
||||
final http.Client client = http.Client();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:html/parser.dart' as parser;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
|
||||
class SendvidExtractor {
|
||||
final http.Client client = http.Client();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
|
||||
class SibnetExtractor {
|
||||
final http.Client client = http.Client();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/others.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
|
||||
class StreamlareExtractor {
|
||||
final http.Client client = http.Client();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:html/parser.dart' show parse;
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
|
||||
class StreamTapeExtractor {
|
||||
Future<List<Video>> videosFromUrl(String url,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:js_packer/js_packer.dart';
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/others.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/utils/xpath_selector.dart';
|
||||
|
||||
class StreamWishExtractor {
|
||||
|
|
@ -19,11 +20,11 @@ class StreamWishExtractor {
|
|||
if (jsEval.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
|
||||
String? masterUrl = jsEval.first
|
||||
|
||||
String? masterUrl = jsEval.first!
|
||||
.let(
|
||||
(script) {
|
||||
if (script!.contains("function(p,a,c")) {
|
||||
if (script.contains("function(p,a,c")) {
|
||||
return JSPacker(script).unpack() ?? "";
|
||||
}
|
||||
return script;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/utils/xpath_selector.dart';
|
||||
|
||||
class VidBomExtractor {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/utils/xpath_selector.dart';
|
||||
|
||||
class VoeExtractor {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:http/http.dart' as http;
|
||||
import 'package:mangayomi/models/video.dart';
|
||||
import 'package:mangayomi/utils/extensions.dart';
|
||||
import 'package:mangayomi/utils/extensions/string_extensions.dart';
|
||||
import 'package:mangayomi/utils/xpath_selector.dart';
|
||||
|
||||
class YourUploadExtractor {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ import 'dart:convert';
|
|||
class TestSource extends MProvider {
|
||||
TestSource();
|
||||
|
||||
@override
|
||||
bool get supportsLatest => true;
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
// TODO: implement
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
Color primaryColor(BuildContext context) {
|
||||
return Theme.of(context).primaryColor;
|
||||
}
|
||||
|
||||
Color secondaryColor(BuildContext context) {
|
||||
return Theme.of(context).iconTheme.color!.withOpacity(0.7);
|
||||
}
|
||||
31
lib/utils/extensions/build_context_extensions.dart
Normal file
31
lib/utils/extensions/build_context_extensions.dart
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
extension BuildContextExtensions on BuildContext {
|
||||
bool get isLight {
|
||||
return Theme.of(this).brightness == Brightness.light;
|
||||
}
|
||||
|
||||
Color get primaryColor {
|
||||
return Theme.of(this).primaryColor;
|
||||
}
|
||||
|
||||
Color get secondaryColor {
|
||||
return Theme.of(this).iconTheme.color!.withOpacity(0.7);
|
||||
}
|
||||
|
||||
double mediaHeight(double data) {
|
||||
return MediaQuery.of(this).size.height * data;
|
||||
}
|
||||
|
||||
double mediaWidth(double data) {
|
||||
return MediaQuery.of(this).size.width * data;
|
||||
}
|
||||
|
||||
bool get isDesktop {
|
||||
return MediaQuery.of(this).size.width >= 1200;
|
||||
}
|
||||
|
||||
bool get isTablet {
|
||||
return MediaQuery.of(this).size.width >= 600;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,70 +2,6 @@ import 'package:html/dom.dart';
|
|||
import 'package:mangayomi/utils/reg_exp_matcher.dart';
|
||||
import 'package:xpath_selector_html_parser/xpath_selector_html_parser.dart';
|
||||
|
||||
extension StringExtensions on String {
|
||||
String substringAfter(String pattern) {
|
||||
final startIndex = indexOf(pattern);
|
||||
if (startIndex == -1) return substring(0);
|
||||
|
||||
final start = startIndex + pattern.length;
|
||||
return substring(start);
|
||||
}
|
||||
|
||||
String substringAfterLast(String pattern) {
|
||||
return split(pattern).last;
|
||||
}
|
||||
|
||||
String substringBefore(String pattern) {
|
||||
final endIndex = indexOf(pattern);
|
||||
if (endIndex == -1) return substring(0);
|
||||
|
||||
return substring(0, endIndex);
|
||||
}
|
||||
|
||||
String substringBeforeLast(String pattern) {
|
||||
final endIndex = lastIndexOf(pattern);
|
||||
if (endIndex == -1) return substring(0);
|
||||
|
||||
return substring(0, endIndex);
|
||||
}
|
||||
|
||||
String substringBetween(String left, String right) {
|
||||
int startIndex = 0;
|
||||
int index = indexOf(left, startIndex);
|
||||
if (index == -1) return "";
|
||||
int leftIndex = index + left.length;
|
||||
int rightIndex = indexOf(right, leftIndex);
|
||||
if (rightIndex == -1) return "";
|
||||
startIndex = rightIndex + right.length;
|
||||
return substring(leftIndex, rightIndex);
|
||||
}
|
||||
|
||||
bool isMediaVideo() {
|
||||
return [
|
||||
"3gp",
|
||||
"avi",
|
||||
"mpg",
|
||||
"mpeg",
|
||||
"webm",
|
||||
"ogg",
|
||||
"flv",
|
||||
"m4v",
|
||||
"mvp",
|
||||
"mp4",
|
||||
"wmv",
|
||||
"mkv",
|
||||
"mov",
|
||||
"ts"
|
||||
].any((extension) => toLowerCase().endsWith(extension));
|
||||
}
|
||||
}
|
||||
|
||||
extension LetExtension<T> on T {
|
||||
R let<R>(R Function(T) block) {
|
||||
return block(this);
|
||||
}
|
||||
}
|
||||
|
||||
extension DocumentExtension on Document? {
|
||||
List<Element>? select(String selector) {
|
||||
try {
|
||||
5
lib/utils/extensions/others.dart
Normal file
5
lib/utils/extensions/others.dart
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
extension LetExtension<T> on T {
|
||||
R let<R>(R Function(T) block) {
|
||||
return block(this);
|
||||
}
|
||||
}
|
||||
57
lib/utils/extensions/string_extensions.dart
Normal file
57
lib/utils/extensions/string_extensions.dart
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
extension StringExtensions on String {
|
||||
String substringAfter(String pattern) {
|
||||
final startIndex = indexOf(pattern);
|
||||
if (startIndex == -1) return substring(0);
|
||||
|
||||
final start = startIndex + pattern.length;
|
||||
return substring(start);
|
||||
}
|
||||
|
||||
String substringAfterLast(String pattern) {
|
||||
return split(pattern).last;
|
||||
}
|
||||
|
||||
String substringBefore(String pattern) {
|
||||
final endIndex = indexOf(pattern);
|
||||
if (endIndex == -1) return substring(0);
|
||||
|
||||
return substring(0, endIndex);
|
||||
}
|
||||
|
||||
String substringBeforeLast(String pattern) {
|
||||
final endIndex = lastIndexOf(pattern);
|
||||
if (endIndex == -1) return substring(0);
|
||||
|
||||
return substring(0, endIndex);
|
||||
}
|
||||
|
||||
String substringBetween(String left, String right) {
|
||||
int startIndex = 0;
|
||||
int index = indexOf(left, startIndex);
|
||||
if (index == -1) return "";
|
||||
int leftIndex = index + left.length;
|
||||
int rightIndex = indexOf(right, leftIndex);
|
||||
if (rightIndex == -1) return "";
|
||||
startIndex = rightIndex + right.length;
|
||||
return substring(leftIndex, rightIndex);
|
||||
}
|
||||
|
||||
bool isMediaVideo() {
|
||||
return [
|
||||
"3gp",
|
||||
"avi",
|
||||
"mpg",
|
||||
"mpeg",
|
||||
"webm",
|
||||
"ogg",
|
||||
"flv",
|
||||
"m4v",
|
||||
"mvp",
|
||||
"mp4",
|
||||
"wmv",
|
||||
"mkv",
|
||||
"mov",
|
||||
"ts"
|
||||
].any((extension) => toLowerCase().endsWith(extension));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
double mediaHeight(BuildContext context, double data) {
|
||||
return MediaQuery.of(context).size.height * data;
|
||||
}
|
||||
|
||||
double mediaWidth(BuildContext context, double data) {
|
||||
return MediaQuery.of(context).size.width * data;
|
||||
}
|
||||
|
||||
bool isDesktop(BuildContext context) {
|
||||
return MediaQuery.of(context).size.width >= 1200;
|
||||
}
|
||||
|
||||
bool isTablet(BuildContext context) {
|
||||
return MediaQuery.of(context).size.width >= 600;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
bool isLight(BuildContext context) {
|
||||
return Theme.of(context).brightness == Brightness.light;
|
||||
}
|
||||
Loading…
Reference in a new issue