diff --git a/lib/src/controller/mobile/html_viewer_controller_mobile.dart b/lib/src/controller/mobile/html_viewer_controller_mobile.dart
index a2b7d3a..8bee77f 100644
--- a/lib/src/controller/mobile/html_viewer_controller_mobile.dart
+++ b/lib/src/controller/mobile/html_viewer_controller_mobile.dart
@@ -3,7 +3,6 @@ import 'dart:io';
import 'package:flutter_inappwebview/flutter_inappwebview.dart' as mobile;
import 'package:flutter_super_html_viewer/src/controller/html_viewer_controller_unsupported.dart'
as unsupported;
-import 'package:webview_windows/webview_windows.dart' as window;
/// Controller for mobile
class HtmlViewerController extends unsupported.HtmlViewerController {
@@ -25,8 +24,6 @@ class HtmlViewerController extends unsupported.HtmlViewerController {
if (Platform.isAndroid || Platform.isIOS) {
_webViewController = controller as mobile.InAppWebViewController;
- } else if (Platform.isWindows) {
- _webViewController = controller as window.WebviewController;
}
}
}
diff --git a/lib/src/view/mobile/html_content_viewer_mobile.dart b/lib/src/view/mobile/html_content_viewer_mobile.dart
index e13c0e3..bee4f34 100644
--- a/lib/src/view/mobile/html_content_viewer_mobile.dart
+++ b/lib/src/view/mobile/html_content_viewer_mobile.dart
@@ -4,8 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_super_html_viewer/flutter_super_html_viewer.dart';
import 'package:flutter_super_html_viewer/src/widgets/mobile/html_content_viewer_widget_mobile.dart'
as mobile;
-import 'package:flutter_super_html_viewer/src/widgets/desktop/html_content_viewer_widget_desktop.dart'
- as desktop;
import 'package:flutter_super_html_viewer/utils/app_define.dart';
import 'dart:io' show Platform;
@@ -74,19 +72,6 @@ class HtmlContentViewer extends StatelessWidget {
onScrollHorizontalEnd: onScrollHorizontalEnd,
urlLauncherDelegate: urlLauncherDelegate,
mailtoDelegate: mailtoDelegate);
- } else if (Platform.isWindows) {
- print('VAO isWindows');
- return desktop.HtmlContentViewerWidget(
- htmlContent: htmlContent,
- initialContentHeight: initialContentHeight,
- initialContentWidth: initialContentWidth,
- minContentWidth: minContentWidth,
- minContentHeight: minContentHeight,
- customStyleCssTag: customStyleCssTag,
- customScriptsTag: customScriptsTag,
- loadingView: loadingView,
- controller: controller,
- );
} else {
return const Text('Unsupported in this environment');
}
diff --git a/lib/src/widgets/desktop/html_content_viewer_widget_desktop.dart b/lib/src/widgets/desktop/html_content_viewer_widget_desktop.dart
deleted file mode 100644
index 60b94cd..0000000
--- a/lib/src/widgets/desktop/html_content_viewer_widget_desktop.dart
+++ /dev/null
@@ -1,134 +0,0 @@
-import 'dart:developer';
-
-import 'package:flutter/cupertino.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_super_html_viewer/flutter_super_html_viewer.dart'
- as html_viewer;
-import 'package:flutter_super_html_viewer/utils/color_utils.dart';
-import 'package:flutter_super_html_viewer/utils/html_utils.dart';
-import 'package:webview_windows/webview_windows.dart';
-
-class HtmlContentViewerWidget extends StatefulWidget {
- final String htmlContent;
- final double initialContentHeight;
- final double initialContentWidth;
- final double minContentHeight;
- final double minContentWidth;
- final String? customStyleCssTag;
- final String? customScriptsTag;
- final Widget? loadingView;
- final html_viewer.HtmlViewerController? controller;
-
- const HtmlContentViewerWidget({
- Key? key,
- required this.htmlContent,
- this.initialContentHeight = 400,
- this.initialContentWidth = 1000,
- this.minContentWidth = 300,
- this.minContentHeight = 100,
- this.customStyleCssTag,
- this.customScriptsTag,
- this.loadingView,
- this.controller,
- }) : super(key: key);
-
- @override
- State createState() =>
- _HtmlContentViewerWidgetState();
-}
-
-class _HtmlContentViewerWidgetState extends State {
- late double actualHeight;
- late double actualWidth;
- late WebviewController _controller;
-
- bool _isLoading = true;
-
- @override
- void initState() {
- super.initState();
-
- actualHeight = widget.initialContentHeight;
- actualWidth = widget.initialContentWidth;
- if (widget.controller != null) {
- _controller = widget.controller!.webViewController;
- } else {
- _controller = WebviewController();
- }
- print('VAO _controller $_controller');
- _setUpConfigWebView();
- }
-
- void _setUpConfigWebView() async {
- await _controller.initialize();
- await _controller.setBackgroundColor(Colors.white);
-
- final htmlDocument = HtmlUtils.generateHtmlDocument(widget.htmlContent,
- customScriptsTag: widget.customScriptsTag,
- customStyleCssTag: widget.customStyleCssTag,
- minHeight: widget.minContentHeight,
- minWidth: widget.minContentWidth);
-
- await _controller.loadStringContent(htmlDocument);
-
- _listenEventWebView();
-
- setState(() {
- _isLoading = false;
- });
- }
-
- void _listenEventWebView() async {
- _controller.addListener(() {
- log('_DesktopHtmlContentViewerState::_setUpConfigWebView():addListener');
- });
-
- _controller.loadingState.listen((event) {
- log('_DesktopHtmlContentViewerState::_setUpConfigWebView():loadingState: $event');
- });
-
- _controller.onLoadError.listen((event) {
- log('_DesktopHtmlContentViewerState::_setUpConfigWebView():onLoadError: $event');
- });
-
- _controller.webMessage.listen((event) {
- log('_DesktopHtmlContentViewerState::_setUpConfigWebView():webMessage: $event');
- });
- }
-
- @override
- Widget build(BuildContext context) {
- return LayoutBuilder(builder: (context, constraints) {
- return Stack(
- children: [
- SizedBox(
- height: actualHeight,
- width: constraints.maxWidth,
- child: _buildWebView(),
- ),
- if (_isLoading) _buildLoadingView()
- ],
- );
- });
- }
-
- Widget _buildLoadingView() {
- return const Center(
- child: Padding(
- padding: EdgeInsets.all(16),
- child: SizedBox(
- width: 30,
- height: 30,
- child:
- CupertinoActivityIndicator(color: ColorUtils.colorLoading))),
- );
- }
-
- Widget _buildWebView() {
- return Webview(
- _controller,
- height: actualHeight,
- width: actualWidth,
- );
- }
-}
diff --git a/pubspec.lock b/pubspec.lock
index 52ac44e..9e5b778 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: async
- sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
+ sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
- version: "2.10.0"
+ version: "2.11.0"
boolean_selector:
dependency: transitive
description:
@@ -21,10 +21,10 @@ packages:
dependency: transitive
description:
name: characters
- sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
+ sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
- version: "1.2.1"
+ version: "1.3.0"
charcode:
dependency: transitive
description:
@@ -45,26 +45,26 @@ packages:
dependency: transitive
description:
name: collection
- sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
+ sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
- version: "1.17.0"
+ version: "1.18.0"
csslib:
dependency: transitive
description:
name: csslib
- sha256: b36c7f7e24c0bdf1bf9a3da461c837d1de64b9f8beb190c9011d8c72a3dfd745
+ sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb"
url: "https://pub.dev"
source: hosted
- version: "0.17.2"
+ version: "1.0.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
- sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be
+ sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
url: "https://pub.dev"
source: hosted
- version: "1.0.5"
+ version: "1.0.8"
fake_async:
dependency: transitive
description:
@@ -82,26 +82,74 @@ packages:
dependency: "direct main"
description:
name: flutter_inappwebview
- sha256: "6d6c741ddba1dba5229d63ba75767064791a7ce845196b45e31105e93d67c949"
+ sha256: "93cfcca02bdda4b26cd700cf70d9ddba09d8348e3e8f2857638c23ed23a4fcb4"
url: "https://pub.dev"
source: hosted
- version: "6.0.0-beta.22"
+ version: "6.1.4"
+ flutter_inappwebview_android:
+ dependency: transitive
+ description:
+ name: flutter_inappwebview_android
+ sha256: "62557c15a5c2db5d195cb3892aab74fcaec266d7b86d59a6f0027abd672cddba"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.3"
flutter_inappwebview_internal_annotations:
dependency: transitive
description:
name: flutter_inappwebview_internal_annotations
- sha256: "064a8ccbc76217dcd3b0fd6c6ea6f549e69b2849a0233b5bb46af9632c3ce2ff"
+ sha256: "5f80fd30e208ddded7dbbcd0d569e7995f9f63d45ea3f548d8dd4c0b473fb4c8"
url: "https://pub.dev"
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
+ flutter_inappwebview_ios:
+ dependency: transitive
+ description:
+ name: flutter_inappwebview_ios
+ sha256: "5818cf9b26cf0cbb0f62ff50772217d41ea8d3d9cc00279c45f8aabaa1b4025d"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.2"
+ flutter_inappwebview_macos:
+ dependency: transitive
+ description:
+ name: flutter_inappwebview_macos
+ sha256: c1fbb86af1a3738e3541364d7d1866315ffb0468a1a77e34198c9be571287da1
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.2"
+ flutter_inappwebview_platform_interface:
+ dependency: transitive
+ description:
+ name: flutter_inappwebview_platform_interface
+ sha256: cf5323e194096b6ede7a1ca808c3e0a078e4b33cc3f6338977d75b4024ba2500
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.3.0+1"
+ flutter_inappwebview_web:
+ dependency: transitive
+ description:
+ name: flutter_inappwebview_web
+ sha256: "55f89c83b0a0d3b7893306b3bb545ba4770a4df018204917148ebb42dc14a598"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.2"
+ flutter_inappwebview_windows:
+ dependency: transitive
+ description:
+ name: flutter_inappwebview_windows
+ sha256: "95ebc65aecfa63b2084c822aec6ba0545f0a0afaa3899f2c752ec96c09108db5"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.5.0+2"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
- sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
+ sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
url: "https://pub.dev"
source: hosted
- version: "2.0.1"
+ version: "5.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -116,66 +164,82 @@ packages:
dependency: transitive
description:
name: html
- sha256: d9793e10dbe0e6c364f4c59bf3e01fb33a9b2a674bc7a1081693dba0614b6269
+ sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.15.4"
+ leak_tracker:
+ dependency: transitive
+ description:
+ name: leak_tracker
+ sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev"
source: hosted
- version: "0.15.1"
- js:
+ version: "10.0.5"
+ leak_tracker_flutter_testing:
dependency: transitive
description:
- name: js
- sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
+ name: leak_tracker_flutter_testing
+ sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev"
source: hosted
- version: "0.6.5"
+ version: "3.0.5"
+ leak_tracker_testing:
+ dependency: transitive
+ description:
+ name: leak_tracker_testing
+ sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.1"
lints:
dependency: transitive
description:
name: lints
- sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593"
+ sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413"
url: "https://pub.dev"
source: hosted
- version: "2.0.1"
+ version: "5.0.0"
matcher:
dependency: transitive
description:
name: matcher
- sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
+ sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
- version: "0.12.13"
+ version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
- sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
+ sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
- version: "0.2.0"
+ version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
- sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
+ sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
- version: "1.8.0"
+ version: "1.15.0"
path:
dependency: transitive
description:
name: path
- sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
+ sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
- version: "1.8.2"
+ version: "1.9.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
- sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a
+ sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
- version: "2.1.3"
+ version: "2.1.8"
sky_engine:
dependency: transitive
description: flutter
@@ -185,26 +249,26 @@ packages:
dependency: transitive
description:
name: source_span
- sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
+ sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
- version: "1.9.1"
+ version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
- sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
+ sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
- version: "1.11.0"
+ version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
- sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
+ sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
- version: "2.1.1"
+ version: "2.1.2"
string_scanner:
dependency: transitive
description:
@@ -225,98 +289,98 @@ packages:
dependency: transitive
description:
name: test_api
- sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
+ sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
url: "https://pub.dev"
source: hosted
- version: "0.4.16"
+ version: "0.7.2"
typed_data:
dependency: transitive
description:
name: typed_data
- sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5"
+ sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
- version: "1.3.1"
+ version: "1.3.2"
universal_html:
dependency: "direct main"
description:
name: universal_html
- sha256: b5061c64c7c863c12e46279e032976f1c274f927fb3589b52b5928dcd2d52f7c
+ sha256: "56536254004e24d9d8cfdb7dbbf09b74cf8df96729f38a2f5c238163e3d58971"
url: "https://pub.dev"
source: hosted
- version: "2.0.9"
+ version: "2.2.4"
universal_io:
dependency: transitive
description:
name: universal_io
- sha256: "06866290206d196064fd61df4c7aea1ffe9a4e7c4ccaa8fcded42dd41948005d"
+ sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev"
source: hosted
- version: "2.2.0"
+ version: "2.2.2"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
- sha256: "75f2846facd11168d007529d6cd8fcb2b750186bea046af9711f10b907e1587e"
+ sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3"
url: "https://pub.dev"
source: hosted
- version: "6.1.10"
+ version: "6.3.0"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
- sha256: "6f91d30ce9060c204b2dbe728adb300750fa4b228e8f7ed1b961aa1ceb728799"
+ sha256: "8fc3bae0b68c02c47c5c86fa8bfa74471d42687b0eded01b78de87872db745e2"
url: "https://pub.dev"
source: hosted
- version: "6.0.22"
+ version: "6.3.12"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
- sha256: "6ba7dddee26c9fae27c9203c424631109d73c8fa26cfa7bc3e35e751cb87f62e"
+ sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e
url: "https://pub.dev"
source: hosted
- version: "6.0.17"
+ version: "6.3.1"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
- sha256: "360fa359ab06bcb4f7c5cd3123a2a9a4d3364d4575d27c4b33468bd4497dd094"
+ sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af
url: "https://pub.dev"
source: hosted
- version: "3.0.1"
+ version: "3.2.0"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
- sha256: a9b3ea9043eabfaadfa3fb89de67a11210d85569086d22b3854484beab8b3978
+ sha256: "769549c999acdb42b8bcfa7c43d72bf79a382ca7441ab18a808e101149daf672"
url: "https://pub.dev"
source: hosted
- version: "3.0.1"
+ version: "3.2.1"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
- sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6"
+ sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
url: "https://pub.dev"
source: hosted
- version: "2.1.1"
+ version: "2.3.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
- sha256: "5669882643b96bb6d5786637cac727c6e918a790053b09245fd4513b8a07df2a"
+ sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e"
url: "https://pub.dev"
source: hosted
- version: "2.0.13"
+ version: "2.3.3"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
- sha256: e3c3b16d3104260c10eea3b0e34272aaa57921f83148b0619f74c2eced9b7ef1
+ sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185"
url: "https://pub.dev"
source: hosted
- version: "3.0.1"
+ version: "3.1.2"
vector_math:
dependency: transitive
description:
@@ -325,14 +389,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
- webview_windows:
- dependency: "direct main"
+ vm_service:
+ dependency: transitive
+ description:
+ name: vm_service
+ sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
+ url: "https://pub.dev"
+ source: hosted
+ version: "14.2.5"
+ web:
+ dependency: transitive
description:
- name: webview_windows
- sha256: d6f2b8473756a5aa45f2361ddbc8ecf7bde7ba0a5a04975bbcde8a1615d74144
+ name: web
+ sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
url: "https://pub.dev"
source: hosted
- version: "0.2.1"
+ version: "1.1.0"
sdks:
- dart: ">=2.19.2 <3.0.0"
- flutter: ">=3.0.0"
+ dart: ">=3.5.0 <4.0.0"
+ flutter: ">=3.24.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index da27737..465f245 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -4,28 +4,26 @@ homepage: https://github.com/dab246/flutter_super_html_viewer.git
version: 0.1.0
environment:
- sdk: ">=2.19.2 <3.0.0"
- flutter: ">=3.0.0"
+ sdk: '>=3.1.0 <4.0.0'
dependencies:
flutter:
sdk: flutter
- cupertino_icons: ^1.0.5
+ cupertino_icons: ^1.0.8
- flutter_inappwebview: ^6.0.0-beta.22
+ flutter_inappwebview: ^6.1.4
- url_launcher: ^6.1.10
+ url_launcher: ^6.3.0
- universal_html: ^2.0.9
+ universal_html: ^2.2.4
- webview_windows: ^0.2.1
dev_dependencies:
flutter_test:
sdk: flutter
- flutter_lints: ^2.0.1
+ flutter_lints: ^5.0.0
flutter: