Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

upgrade webview version and set sourceType to url by default #53

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 3 additions & 4 deletions example/lib/webview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,27 @@ class _WebViewXPageState extends State<WebViewXPage> {
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,
);
}
Expand Down
48 changes: 38 additions & 10 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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"
7 changes: 3 additions & 4 deletions lib/src/controller/impl/mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<wf.WebViewController> {
Expand Down Expand Up @@ -73,8 +72,8 @@ class WebViewXController extends ChangeNotifier
///
@override
Future<void> loadContent(
String content,
SourceType sourceType, {
String content, {
SourceType sourceType = SourceType.url,
Map<String, String>? headers,
Object? body, // NO-OP HERE
bool fromAssets = false,
Expand Down
7 changes: 3 additions & 4 deletions lib/src/controller/impl/web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<js.JsObject> {
Expand Down Expand Up @@ -80,8 +79,8 @@ class WebViewXController extends ChangeNotifier
///
@override
Future<void> loadContent(
String content,
SourceType sourceType, {
String content, {
SourceType sourceType = SourceType.url,
Map<String, String>? headers,
Object? body,
bool fromAssets = false,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/controller/interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ abstract class WebViewXController<T> {
/// `body` is only used on the WEB version, when clicking on a submit button in a form
///
Future<void> loadContent(
String content,
SourceType sourceType, {
String content, {
SourceType sourceType = SourceType.url,
Map<String, String>? headers,
Object? body,
bool fromAssets = false,
Expand Down
48 changes: 38 additions & 10 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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"
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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:
Expand Down