diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9a350..7d8c107 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.2 + +- Update webview_flutter to 3.0.0 +- Controller loadContent method now have default url sourceType + ## 0.2.1 - Breaking change diff --git a/example/lib/webview_page.dart b/example/lib/webview_page.dart index 01e41b3..52a10c3 100644 --- a/example/lib/webview_page.dart +++ b/example/lib/webview_page.dart @@ -120,28 +120,27 @@ class _WebViewXPageState extends State { void _setUrl() { webviewController.loadContent( 'https://flutter.dev', - SourceType.url, ); } void _setUrlBypass() { webviewController.loadContent( 'https://news.ycombinator.com/', - SourceType.urlBypass, + sourceType: SourceType.urlBypass, ); } void _setHtml() { webviewController.loadContent( initialContent, - SourceType.html, + sourceType: SourceType.html, ); } void _setHtmlFromAssets() { webviewController.loadContent( 'assets/test.html', - SourceType.html, + sourceType: SourceType.html, fromAssets: true, ); } diff --git a/example/pubspec.lock b/example/pubspec.lock index 9f356e2..139da31 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -21,14 +21,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" clock: dependency: transitive description: @@ -101,14 +101,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" path: dependency: transitive description: @@ -123,6 +123,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.11.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" pointer_interceptor: dependency: transitive description: @@ -176,7 +183,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.3" typed_data: dependency: transitive description: @@ -197,14 +204,35 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" webview_flutter: dependency: transitive description: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "3.0.0" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.8.2" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + url: "https://pub.dartlang.org" + source: hosted + version: "2.7.1" webviewx: dependency: "direct main" description: @@ -213,5 +241,5 @@ packages: source: path version: "0.2.1" sdks: - dart: ">=2.13.0 <3.0.0" - flutter: ">=2.0.0" + dart: ">=2.14.0 <3.0.0" + flutter: ">=2.5.0" diff --git a/lib/src/controller/impl/mobile.dart b/lib/src/controller/impl/mobile.dart index d3c2be9..d5b16b4 100644 --- a/lib/src/controller/impl/mobile.dart +++ b/lib/src/controller/impl/mobile.dart @@ -3,12 +3,11 @@ import 'dart:async' show Future; import 'package:flutter/material.dart'; import 'package:flutter/services.dart' show rootBundle; import 'package:webview_flutter/webview_flutter.dart' as wf; +import 'package:webviewx/src/controller/interface.dart' as i; import 'package:webviewx/src/utils/html_utils.dart'; import 'package:webviewx/src/utils/source_type.dart'; import 'package:webviewx/src/utils/utils.dart'; -import 'package:webviewx/src/controller/interface.dart' as i; - /// Mobile implementation class WebViewXController extends ChangeNotifier implements i.WebViewXController { @@ -73,8 +72,8 @@ class WebViewXController extends ChangeNotifier /// @override Future loadContent( - String content, - SourceType sourceType, { + String content, { + SourceType sourceType = SourceType.url, Map? headers, Object? body, // NO-OP HERE bool fromAssets = false, diff --git a/lib/src/controller/impl/web.dart b/lib/src/controller/impl/web.dart index ec69923..fe87de3 100644 --- a/lib/src/controller/impl/web.dart +++ b/lib/src/controller/impl/web.dart @@ -4,13 +4,12 @@ import 'dart:js' as js; import 'package:flutter/material.dart'; import 'package:flutter/services.dart' show rootBundle; +import 'package:webviewx/src/controller/interface.dart' as i; import 'package:webviewx/src/utils/logger.dart'; import 'package:webviewx/src/utils/source_type.dart'; import 'package:webviewx/src/utils/utils.dart'; import 'package:webviewx/src/utils/web_history.dart'; -import 'package:webviewx/src/controller/interface.dart' as i; - /// Web implementation class WebViewXController extends ChangeNotifier implements i.WebViewXController { @@ -80,8 +79,8 @@ class WebViewXController extends ChangeNotifier /// @override Future loadContent( - String content, - SourceType sourceType, { + String content, { + SourceType sourceType = SourceType.url, Map? headers, Object? body, bool fromAssets = false, diff --git a/lib/src/controller/interface.dart b/lib/src/controller/interface.dart index ebfe75a..e0d8187 100644 --- a/lib/src/controller/interface.dart +++ b/lib/src/controller/interface.dart @@ -39,8 +39,8 @@ abstract class WebViewXController { /// `body` is only used on the WEB version, when clicking on a submit button in a form /// Future loadContent( - String content, - SourceType sourceType, { + String content, { + SourceType sourceType = SourceType.url, Map? headers, Object? body, bool fromAssets = false, diff --git a/pubspec.lock b/pubspec.lock index e1c3fd8..0dfb33b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -21,14 +21,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" clock: dependency: transitive description: @@ -94,14 +94,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" path: dependency: "direct main" description: @@ -116,6 +116,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.11.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" pointer_interceptor: dependency: "direct main" description: @@ -169,7 +176,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.3" typed_data: dependency: transitive description: @@ -190,14 +197,35 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" webview_flutter: dependency: "direct main" description: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "3.0.0" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.8.2" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + url: "https://pub.dartlang.org" + source: hosted + version: "2.7.1" sdks: - dart: ">=2.13.0 <3.0.0" - flutter: ">=2.0.0" + dart: ">=2.14.0 <3.0.0" + flutter: ">=2.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index 7a05af0..57c6023 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: webviewx description: A feature-rich cross-platform webview using webview_flutter for mobile and iframe for web. JS interop-ready. homepage: https://github.com/adrianflutur/webviewx -version: 0.2.1 +version: 0.2.2 environment: sdk: ">=2.12.0 <3.0.0" @@ -15,7 +15,7 @@ dependencies: path: ^1.8.0 pointer_interceptor: ^0.9.0+1 uuid: ^3.0.4 - webview_flutter: ^2.0.13 + webview_flutter: ^3.0.0 dev_dependencies: flutter_test: