diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 00000000..fa0b357c --- /dev/null +++ b/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: diff --git a/lib/modules/novel/novel_reader_view.dart b/lib/modules/novel/novel_reader_view.dart index b4530fd4..f10febeb 100644 --- a/lib/modules/novel/novel_reader_view.dart +++ b/lib/modules/novel/novel_reader_view.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:mangayomi/models/chapter.dart'; import 'package:mangayomi/models/page.dart'; +import 'package:mangayomi/models/settings.dart'; import 'package:mangayomi/modules/anime/widgets/desktop.dart'; import 'package:mangayomi/modules/manga/reader/widgets/btn_chapter_list_dialog.dart'; import 'package:mangayomi/modules/more/settings/reader/providers/reader_state_provider.dart'; @@ -19,10 +20,9 @@ import 'package:mangayomi/modules/manga/reader/providers/push_router.dart'; import 'package:mangayomi/services/get_chapter_pages.dart'; import 'package:mangayomi/utils/extensions/build_context_extensions.dart'; import 'package:mangayomi/utils/global_style.dart'; -import 'package:mangayomi/modules/manga/reader/providers/reader_controller_provider.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:window_manager/window_manager.dart'; -import 'package:flutter_html/flutter_html.dart'; +import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; typedef DoubleClickAnimationListener = void Function(); @@ -179,27 +179,54 @@ class _NovelWebViewState extends ConsumerState bottom: false, child: Stack( children: [ - widget.htmlContent.when( - data: (htmlContent) => Expanded( - child: SingleChildScrollView( - physics: const BouncingScrollPhysics(), - child: Html( - data: htmlContent, - style: { - "*": Style( - backgroundColor: Colors.white, - margin: Margins.all(5)) - }, - shrinkWrap: true, - ), - ), - ), - loading: () => const Center( - child: CircularProgressIndicator(), - ), - error: (err, stack) => Center( - child: Text(err.toString()), - )), + Row( + children: [ + widget.htmlContent.when( + data: (htmlContent) { + return Expanded( + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: HtmlWidget( + htmlContent, + customStylesBuilder: (element) { + switch (backgroundColor) { + case BackgroundColor.black: + return { + 'background-color': 'black', + }; + default: + return { + 'background-color': '#F0F0F0', + }; + } + }, + onTapUrl: (url) { + print('tapped $url'); + return true; + }, + renderMode: RenderMode.column, + textStyle: TextStyle( + color: backgroundColor == + BackgroundColor.white + ? Colors.black + : Colors.white, + //fontFamily: "Times New Roman", + //fontFamilyFallback: ["Times", "serif"], + fontSize: 14), + ), + ), + );}, + loading: () => const Expanded( + child: Center( + child: CircularProgressIndicator(), + )), + error: (err, stack) => Center( + child: Text(err.toString()), + )), + ], + ), + _gestureRightLeft(), + _gestureTopBottom(), _appBar(), ], ), @@ -335,6 +362,84 @@ class _NovelWebViewState extends ConsumerState } } } + + Widget _gestureRightLeft() { + return Consumer( + builder: (context, ref, child) { + return Row( + children: [ + /// left region + Expanded( + flex: 2, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + _isViewFunction(); + }, + ), + ), + + /// center region + Expanded( + flex: 2, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + _isViewFunction(); + }, + ), + ), + + /// right region + Expanded( + flex: 2, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + _isViewFunction(); + }, + ), + ), + ], + ); + }, + ); + } + + Widget _gestureTopBottom() { + return Consumer( + builder: (context, ref, child) { + return Column( + children: [ + /// top region + Expanded( + flex: 2, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + _isViewFunction(); + }, + ), + ), + + /// center region + const Expanded(flex: 5, child: SizedBox.shrink()), + + /// bottom region + Expanded( + flex: 2, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + _isViewFunction(); + }, + ), + ), + ], + ); + }, + ); + } } class UChapDataPreload { diff --git a/lib/services/aniskip.g.dart b/lib/services/aniskip.g.dart index b2e1defb..c05db920 100644 --- a/lib/services/aniskip.g.dart +++ b/lib/services/aniskip.g.dart @@ -6,7 +6,7 @@ part of 'aniskip.dart'; // RiverpodGenerator // ************************************************************************** -String _$aniSkipHash() => r'887869b54e2e151633efd46da83bde845e14f421'; +String _$aniSkipHash() => r'2e5d19b025a2207ff64da7bf7908450ea9e5ff8c'; /// See also [AniSkip]. @ProviderFor(AniSkip) diff --git a/lib/services/get_html_content.dart b/lib/services/get_html_content.dart index fdf9e3e6..f9de3236 100644 --- a/lib/services/get_html_content.dart +++ b/lib/services/get_html_content.dart @@ -20,5 +20,8 @@ Future getHtmlContent(Ref ref, {required Chapter chapter}) async { } else { html = await JsExtensionService(source).getHtmlContent(chapter.url!); } - return html; + return '''
${html.substring(1, html.length - 1)}
''' + .replaceAll("\\n", "") + .replaceAll("\\t", "") + .replaceAll("\\", ""); } diff --git a/lib/services/get_html_content.g.dart b/lib/services/get_html_content.g.dart index 6737048f..8bf4df3c 100644 --- a/lib/services/get_html_content.g.dart +++ b/lib/services/get_html_content.g.dart @@ -6,7 +6,7 @@ part of 'get_html_content.dart'; // RiverpodGenerator // ************************************************************************** -String _$getHtmlContentHash() => r'709b68d8d590290081b409c22e402b7d1a7eec76'; +String _$getHtmlContentHash() => r'5369236d1d8058cd42a832d1d641a37777da653b'; /// Copied from Dart SDK class _SystemHash { diff --git a/lib/services/trackers/anilist.g.dart b/lib/services/trackers/anilist.g.dart index ea4d0e96..dd740dcc 100644 --- a/lib/services/trackers/anilist.g.dart +++ b/lib/services/trackers/anilist.g.dart @@ -6,7 +6,7 @@ part of 'anilist.dart'; // RiverpodGenerator // ************************************************************************** -String _$anilistHash() => r'87784b25bccf5b1c61d6c7494f0569a28494dd8b'; +String _$anilistHash() => r'd3a8852d689b13c3bde46ec05b464e7779149e58'; /// Copied from Dart SDK class _SystemHash { diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 0ffae2aa..3c553d1b 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,10 +5,12 @@ import FlutterMacOS import Foundation +import audio_session import flutter_inappwebview_macos import flutter_qjs import flutter_web_auth_2 import isar_flutter_libs +import just_audio import media_kit_libs_macos_video import media_kit_video import package_info_plus @@ -16,16 +18,21 @@ import path_provider_foundation import screen_brightness_macos import screen_retriever_macos import share_plus +import sqflite_darwin import url_launcher_macos +import video_player_avfoundation import wakelock_plus +import webview_flutter_wkwebview import window_manager import window_to_front func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) FlutterQjsPlugin.register(with: registry.registrar(forPlugin: "FlutterQjsPlugin")) FlutterWebAuth2Plugin.register(with: registry.registrar(forPlugin: "FlutterWebAuth2Plugin")) IsarFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "IsarFlutterLibsPlugin")) + JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin")) MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) @@ -33,8 +40,11 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin")) ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) + SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) + FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) + FLTWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "FLTWebViewFlutterPlugin")) WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) WindowToFrontPlugin.register(with: registry.registrar(forPlugin: "WindowToFrontPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 168a4438..27200090 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -70,6 +70,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" + audio_session: + dependency: transitive + description: + name: audio_session + sha256: b2a26ba8b7efa1790d6460e82971fde3e398cfbe2295df9dea22f3499d2c12a7 + url: "https://pub.dev" + source: hosted + version: "0.1.23" autotrie: dependency: transitive description: @@ -166,6 +174,30 @@ packages: url: "https://pub.dev" source: hosted version: "8.9.3" + cached_network_image: + dependency: transitive + description: + name: cached_network_image + sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" + url: "https://pub.dev" + source: hosted + version: "4.1.1" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062" + url: "https://pub.dev" + source: hosted + version: "1.3.1" change_case: dependency: transitive description: @@ -198,6 +230,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + chewie: + dependency: transitive + description: + name: chewie + sha256: "335df378c025588aef400c704bd71f0daea479d4cd57c471c88c056c1144e7cd" + url: "https://pub.dev" + source: hosted + version: "1.8.5" cli_util: dependency: transitive description: @@ -468,6 +508,14 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" + url: "https://pub.dev" + source: hosted + version: "3.4.1" flutter_code_editor: dependency: "direct main" description: @@ -484,14 +532,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.0" - flutter_html: - dependency: "direct main" - description: - name: flutter_html - sha256: "02ad69e813ecfc0728a455e4bf892b9379983e050722b1dce00192ee2e41d1ee" - url: "https://pub.dev" - source: hosted - version: "3.0.0-beta.2" flutter_inappwebview: dependency: "direct main" description: @@ -610,6 +650,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.7.0" + flutter_svg: + dependency: transitive + description: + name: flutter_svg + sha256: "54900a1a1243f3c4a5506d853a2b5c2dbc38d5f27e52a52618a8054401431123" + url: "https://pub.dev" + source: hosted + version: "2.0.16" flutter_test: dependency: "direct dev" description: flutter @@ -636,6 +684,22 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_widget_from_html: + dependency: "direct main" + description: + name: flutter_widget_from_html + sha256: f3967a5b42896662efdd420b5adaf8a7d3692b0f44462a07c80e3b4c173b1a02 + url: "https://pub.dev" + source: hosted + version: "0.15.3" + flutter_widget_from_html_core: + dependency: transitive + description: + name: flutter_widget_from_html_core + sha256: b1048fd119a14762e2361bd057da608148a895477846d6149109b2151d2f7abf + url: "https://pub.dev" + source: hosted + version: "0.15.2" font_awesome_flutter: dependency: "direct main" description: @@ -668,6 +732,54 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + fwfh_cached_network_image: + dependency: transitive + description: + name: fwfh_cached_network_image + sha256: "8e44226801bfba27930673953afce8af44da7e92573be93f60385d9865a089dd" + url: "https://pub.dev" + source: hosted + version: "0.14.3" + fwfh_chewie: + dependency: transitive + description: + name: fwfh_chewie + sha256: "37bde9cedfb6dc5546176f7f0c56af1e814966cb33ec58f16c9565ed93ccb704" + url: "https://pub.dev" + source: hosted + version: "0.14.8" + fwfh_just_audio: + dependency: transitive + description: + name: fwfh_just_audio + sha256: "38dc2c55803bd3cef33042c473e0c40b891ad4548078424641a32032f6a1245f" + url: "https://pub.dev" + source: hosted + version: "0.15.2" + fwfh_svg: + dependency: transitive + description: + name: fwfh_svg + sha256: "550b1014d12b5528d8bdb6e3b44b58721f3fb1f65d7a852d1623a817008bdfc4" + url: "https://pub.dev" + source: hosted + version: "0.8.3" + fwfh_url_launcher: + dependency: transitive + description: + name: fwfh_url_launcher + sha256: b9f5d55a5ae2c2c07243ba33f7ba49ac9544bdb2f4c16d8139df9ccbebe3449c + url: "https://pub.dev" + source: hosted + version: "0.9.1" + fwfh_webview: + dependency: transitive + description: + name: fwfh_webview + sha256: c0a8b664b642f40f4c252a0ab4e72c22dcd97c7fb3a7e50a6b4bdb6f63afca19 + url: "https://pub.dev" + source: hosted + version: "0.15.3" glob: dependency: transitive description: @@ -876,6 +988,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.2" + just_audio: + dependency: transitive + description: + name: just_audio + sha256: a49e7120b95600bd357f37a2bb04cd1e88252f7cdea8f3368803779b925b1049 + url: "https://pub.dev" + source: hosted + version: "0.9.42" + just_audio_platform_interface: + dependency: transitive + description: + name: just_audio_platform_interface + sha256: "0243828cce503c8366cc2090cefb2b3c871aa8ed2f520670d76fd47aa1ab2790" + url: "https://pub.dev" + source: hosted + version: "4.3.0" + just_audio_web: + dependency: transitive + description: + name: just_audio_web + sha256: "9a98035b8b24b40749507687520ec5ab404e291d2b0937823ff45d92cb18d448" + url: "https://pub.dev" + source: hosted + version: "0.4.13" lazy_memo: dependency: transitive description: @@ -924,14 +1060,6 @@ packages: url: "https://pub.dev" source: hosted version: "5.1.0" - list_counter: - dependency: transitive - description: - name: list_counter - sha256: c447ae3dfcd1c55f0152867090e67e219d42fe6d4f2807db4bbe8b8d69912237 - url: "https://pub.dev" - source: hosted - version: "1.0.2" logging: dependency: transitive description: @@ -1071,6 +1199,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" numberpicker: dependency: "direct main" description: @@ -1079,6 +1215,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + octo_image: + dependency: transitive + description: + name: octo_image + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" package_config: dependency: transitive description: @@ -1111,6 +1255,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" path_provider: dependency: "direct main" description: @@ -1263,6 +1415,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.0.1" + provider: + dependency: transitive + description: + name: provider + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + url: "https://pub.dev" + source: hosted + version: "6.1.2" pseudom: dependency: "direct main" description: @@ -1523,6 +1683,46 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.0" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: "2d7299468485dca85efeeadf5d38986909c5eb0cd71fd3db2c2f000e6c9454bb" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: "78f489aab276260cdd26676d2169446c7ecd3484bbd5fead4ca14f3ed4dd9ee3" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "761b9740ecbd4d3e66b8916d784e581861fd3c3553eda85e167bc49fdb68f709" + url: "https://pub.dev" + source: hosted + version: "2.5.4+6" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "96a698e2bc82bd770a4d6aab00b42396a7c63d9e33513a56945cbccb594c2474" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.dev" + source: hosted + version: "2.4.0" stack_trace: dependency: transitive description: @@ -1715,6 +1915,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.5.1" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "27d5fefe86fb9aace4a9f8375b56b3c292b64d8c04510df230f849850d912cb7" + url: "https://pub.dev" + source: hosted + version: "1.1.15" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "2430b973a4ca3c4dbc9999b62b8c719a160100dcbae5c819bae0cacce32c9cdb" + url: "https://pub.dev" + source: hosted + version: "1.1.12" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "1b4b9e706a10294258727674a340ae0d6e64a7231980f9f9a3d12e4b42407aad" + url: "https://pub.dev" + source: hosted + version: "1.1.16" vector_math: dependency: transitive description: @@ -1723,6 +1947,46 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + video_player: + dependency: transitive + description: + name: video_player + sha256: "4a8c3492d734f7c39c2588a3206707a05ee80cef52e8c7f3b2078d430c84bc17" + url: "https://pub.dev" + source: hosted + version: "2.9.2" + video_player_android: + dependency: transitive + description: + name: video_player_android + sha256: "391e092ba4abe2f93b3e625bd6b6a6ec7d7414279462c1c0ee42b5ab8d0a0898" + url: "https://pub.dev" + source: hosted + version: "2.7.16" + video_player_avfoundation: + dependency: transitive + description: + name: video_player_avfoundation + sha256: "33224c19775fd244be2d6e3dbd8e1826ab162877bd61123bf71890772119a2b7" + url: "https://pub.dev" + source: hosted + version: "2.6.5" + video_player_platform_interface: + dependency: transitive + description: + name: video_player_platform_interface + sha256: "229d7642ccd9f3dc4aba169609dd6b5f3f443bb4cc15b82f7785fcada5af9bbb" + url: "https://pub.dev" + source: hosted + version: "6.2.3" + video_player_web: + dependency: transitive + description: + name: video_player_web + sha256: "881b375a934d8ebf868c7fb1423b2bfaa393a0a265fa3f733079a86536064a10" + url: "https://pub.dev" + source: hosted + version: "2.3.3" vm_service: dependency: transitive description: @@ -1787,6 +2051,38 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.1" + webview_flutter: + dependency: transitive + description: + name: webview_flutter + sha256: "889a0a678e7c793c308c68739996227c9661590605e70b1f6cf6b9a6634f7aec" + url: "https://pub.dev" + source: hosted + version: "4.10.0" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + sha256: "3d535126f7244871542b2f0b0fcf94629c9a14883250461f9abe1a6644c1c379" + url: "https://pub.dev" + source: hosted + version: "4.2.0" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + sha256: d937581d6e558908d7ae3dc1989c4f87b786891ab47bb9df7de548a151779d8d + url: "https://pub.dev" + source: hosted + version: "2.10.0" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + sha256: b7e92f129482460951d96ef9a46b49db34bd2e1621685de26e9eaafd9674e7eb + url: "https://pub.dev" + source: hosted + version: "3.16.3" win32: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index d3b1e3f1..38150af2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -78,7 +78,7 @@ dependencies: path: packages/desktop_webview_window ref: main screen_brightness: ^2.0.1 - flutter_html: ^3.0.0-beta.2 + flutter_widget_from_html: ^0.15.3 dependency_overrides: http: ^1.2.2