This commit is contained in:
kodjomoustapha 2024-05-30 14:03:13 +01:00
parent 5927140f2d
commit 49bae6d143
4 changed files with 78 additions and 351 deletions

View file

@ -11,13 +11,11 @@ import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
class DoubleColummVerticalView extends StatelessWidget {
final List<UChapDataPreload?> datas;
final Function(UChapDataPreload datas) onLongPressData;
final Function(double) scale;
final BackgroundColor backgroundColor;
final Function(bool) isFailedToLoadImage;
const DoubleColummVerticalView(
{super.key,
required this.datas,
required this.scale,
required this.onLongPressData,
required this.backgroundColor,
required this.isFailedToLoadImage});

View file

@ -547,7 +547,6 @@ class _MangaChapterPageGalleryState
index2]
: null,
],
scale: (a) {},
backgroundColor:
backgroundColor,
isFailedToLoadImage:
@ -1034,7 +1033,7 @@ class _MangaChapterPageGalleryState
readerMode != ReaderMode.webtoon) {
_autoScroll.value = false;
}
autoPagescroll();
_autoPagescroll();
}
void _onPageChanged(int index) {
@ -1081,7 +1080,7 @@ class _MangaChapterPageGalleryState
late final _pageOffset =
ValueNotifier(_readerController.autoScrollValues().$2);
void autoPagescroll() async {
void _autoPagescroll() async {
if (_isVerticalOrHorizontalContinous()) {
for (int i = 0; i < 1; i++) {
await Future.delayed(const Duration(milliseconds: 100));
@ -1092,7 +1091,7 @@ class _MangaChapterPageGalleryState
offset: _pageOffset.value,
duration: const Duration(milliseconds: 100));
}
autoPagescroll();
_autoPagescroll();
}
}
@ -1207,7 +1206,7 @@ class _MangaChapterPageGalleryState
_autoScroll.value = false;
} else {
if (_autoScrollPage.value) {
autoPagescroll();
_autoPagescroll();
_autoScroll.value = true;
}
}
@ -1413,7 +1412,7 @@ class _MangaChapterPageGalleryState
valueListenable: _autoScroll,
builder: (context, value, child) => IconButton(
onPressed: () {
autoPagescroll();
_autoPagescroll();
_autoScroll.value = !value;
},
icon: Icon(value
@ -2038,6 +2037,7 @@ class _MangaChapterPageGalleryState
Consumer(builder: (context, ref, chil) {
final readerMode = ref.watch(_currentReaderMode);
final usePageTapZones = ref.watch(usePageTapZonesStateProvider);
final cropBorders = ref.watch(cropBordersStateProvider);
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
@ -2056,21 +2056,21 @@ class _MangaChapterPageGalleryState
return getReaderModeName(mode, context);
},
),
// SwitchListTile(
// value: cropBorders,
// title: Text(
// l10n.crop_borders,
// style: TextStyle(
// color: Theme.of(context)
// .textTheme
// .bodyLarge!
// .color!
// .withOpacity(0.9),
// fontSize: 14),
// ),
// onChanged: (value) {
// ref.read(cropBordersStateProvider.notifier).set(value);
// }),
SwitchListTile(
value: cropBorders,
title: Text(
l10n.crop_borders,
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyLarge!
.color!
.withOpacity(0.9),
fontSize: 14),
),
onChanged: (value) {
ref.read(cropBordersStateProvider.notifier).set(value);
}),
SwitchListTile(
value: usePageTapZones,
title: Text(l10n.use_page_tap_zones,
@ -2252,61 +2252,59 @@ class _MangaChapterPageGalleryState
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ExpansionTile(
title: Text(
l10n.custom_color_filter,
style: const TextStyle(fontSize: 14),
),
shape: const StarBorder(),
initiallyExpanded: enableCustomColorFilter,
trailing: IgnorePointer(
child: Switch(
value: enableCustomColorFilter,
onChanged: (_) {},
SwitchListTile(
value: enableCustomColorFilter,
title: Text(
l10n.custom_color_filter,
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyLarge!
.color!
.withOpacity(0.9),
fontSize: 14),
),
onChanged: (value) {
ref
.read(enableCustomColorFilterStateProvider.notifier)
.set(value);
}),
if (enableCustomColorFilter) ...[
rgbaFilterWidget(a, r, g, b, (val) {
if (val.$3 == "r") {
ref
.read(customColorFilterStateProvider.notifier)
.set(a, val.$1.toInt(), g, b, val.$2);
} else if (val.$3 == "g") {
ref
.read(customColorFilterStateProvider.notifier)
.set(a, r, val.$1.toInt(), b, val.$2);
} else if (val.$3 == "b") {
ref
.read(customColorFilterStateProvider.notifier)
.set(a, r, g, val.$1.toInt(), val.$2);
} else {
ref
.read(customColorFilterStateProvider.notifier)
.set(val.$1.toInt(), r, g, b, val.$2);
}
}, context),
CustomPopupMenuButton<ColorFilterBlendMode>(
label: l10n.color_filter_blend_mode,
title: getColorFilterBlendModeName(
colorFilterBlendMode, context),
onSelected: (value) {
ref
.read(colorFilterBlendModeStateProvider.notifier)
.set(value);
},
value: colorFilterBlendMode,
list: ColorFilterBlendMode.values,
itemText: (va) {
return getColorFilterBlendModeName(va, context);
},
),
onExpansionChanged: (val) {
ref
.read(enableCustomColorFilterStateProvider.notifier)
.set(val);
},
children: [
rgbaFilterWidget(a, r, g, b, (val) {
if (val.$3 == "r") {
ref
.read(customColorFilterStateProvider.notifier)
.set(a, val.$1.toInt(), g, b, val.$2);
} else if (val.$3 == "g") {
ref
.read(customColorFilterStateProvider.notifier)
.set(a, r, val.$1.toInt(), b, val.$2);
} else if (val.$3 == "b") {
ref
.read(customColorFilterStateProvider.notifier)
.set(a, r, g, val.$1.toInt(), val.$2);
} else {
ref
.read(customColorFilterStateProvider.notifier)
.set(val.$1.toInt(), r, g, b, val.$2);
}
}, context),
CustomPopupMenuButton<ColorFilterBlendMode>(
label: l10n.color_filter_blend_mode,
title: getColorFilterBlendModeName(
colorFilterBlendMode, context),
onSelected: (value) {
ref
.read(colorFilterBlendModeStateProvider.notifier)
.set(value);
},
value: colorFilterBlendMode,
list: ColorFilterBlendMode.values,
itemText: (va) {
return getColorFilterBlendModeName(va, context);
},
),
],
),
]
],
),
),
@ -2315,7 +2313,7 @@ class _MangaChapterPageGalleryState
], context: context, vsync: this, fullWidth: true);
if (_autoScrollPage.value) {
autoPagescroll();
_autoPagescroll();
_autoScroll.value = true;
}
}

View file

@ -50,6 +50,10 @@ extension UChapDataPreloadExtensions on UChapDataPreload {
if (url != null) {
cachedImage = await getCachedImageFile(url!);
}
if (cachedImage == null) {
await Future.delayed(const Duration(seconds: 3));
cachedImage = await getCachedImageFile(url!);
}
imageBytes = cachedImage?.readAsBytesSync();
}
return imageBytes;

275
rust/Cargo.lock generated
View file

@ -152,12 +152,6 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "bitstream-io"
version = "2.3.0"
@ -200,12 +194,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
[[package]]
name = "bytes"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]]
name = "cc"
version = "1.0.83"
@ -751,17 +739,6 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "mio"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
dependencies = [
"libc",
"wasi",
"windows-sys 0.48.0",
]
[[package]]
name = "new_debug_unreachable"
version = "1.0.6"
@ -870,29 +847,6 @@ dependencies = [
"log",
]
[[package]]
name = "parking_lot"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-targets 0.52.5",
]
[[package]]
name = "paste"
version = "1.0.15"
@ -923,7 +877,7 @@ version = "0.17.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1"
dependencies = [
"bitflags 1.3.2",
"bitflags",
"crc32fast",
"fdeflate",
"flate2",
@ -964,29 +918,6 @@ dependencies = [
"syn",
]
[[package]]
name = "prost"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29"
dependencies = [
"bytes",
"prost-derive",
]
[[package]]
name = "prost-derive"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1"
dependencies = [
"anyhow",
"itertools",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "qoi"
version = "0.4.1"
@ -1111,15 +1042,6 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "redox_syscall"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e"
dependencies = [
"bitflags 2.5.0",
]
[[package]]
name = "regex"
version = "1.10.2"
@ -1162,12 +1084,8 @@ dependencies = [
name = "rust_lib_mangayomi"
version = "0.1.0"
dependencies = [
"allo-isolate",
"flutter_rust_bridge",
"image",
"prost",
"tokio_with_wasm",
"wasm-bindgen",
]
[[package]]
@ -1211,15 +1129,6 @@ dependencies = [
"serde",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
dependencies = [
"libc",
]
[[package]]
name = "simd-adler32"
version = "0.3.7"
@ -1250,16 +1159,6 @@ version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "socket2"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "spin"
version = "0.9.8"
@ -1346,41 +1245,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
dependencies = [
"backtrace",
"bytes",
"libc",
"mio",
"num_cpus",
"parking_lot",
"pin-project-lite",
"signal-hook-registry",
"socket2",
"tokio-macros",
"windows-sys 0.48.0",
]
[[package]]
name = "tokio-macros"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tokio_with_wasm"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa397196e321d38fd486d2ad0dc8f33d8724ce8978cad405e6e0749980504459"
dependencies = [
"futures-channel",
"js-sys",
"tokio",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
@ -1528,145 +1394,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.5",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [
"windows_aarch64_gnullvm 0.52.5",
"windows_aarch64_msvc 0.52.5",
"windows_i686_gnu 0.52.5",
"windows_i686_gnullvm",
"windows_i686_msvc 0.52.5",
"windows_x86_64_gnu 0.52.5",
"windows_x86_64_gnullvm 0.52.5",
"windows_x86_64_msvc 0.52.5",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]]
name = "winnow"
version = "0.6.9"