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

Upgrade packages and linter fixes #106

Open
wants to merge 4 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
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:lint/analysis_options_package.yaml
include: package:flutter_lints/flutter.yaml
linter:
rules:
# Disable
Expand Down
2 changes: 1 addition & 1 deletion example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:lint/analysis_options_package.yaml
include: package:flutter_lints/flutter.yaml
linter:
rules:
# Disable
Expand Down
2 changes: 1 addition & 1 deletion example/lib/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void showAlertDialog(String content, BuildContext context) {
child: AlertDialog(
content: Text(content),
actions: [
TextButton(
ElevatedButton(
onPressed: Navigator.of(context).pop,
child: const Text('Close'),
),
Expand Down
6 changes: 3 additions & 3 deletions example/lib/webview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class WebViewXPage extends StatefulWidget {
}) : super(key: key);

@override
_WebViewXPageState createState() => _WebViewXPageState();
WebViewXPageState createState() => WebViewXPageState();
}

class _WebViewXPageState extends State<WebViewXPage> {
class WebViewXPageState extends State<WebViewXPage> {
late WebViewXController webviewController;
final initialContent =
'<h4> This is some hardcoded HTML code embedded inside the webview <h4> <h2> Hello world! <h2>';
Expand Down Expand Up @@ -59,7 +59,7 @@ class _WebViewXPageState extends State<WebViewXPage> {
),
Expanded(
child: Scrollbar(
isAlwaysShown: true,
thumbVisibility: true,
child: SizedBox(
width: min(screenSize.width * 0.8, 512),
child: ListView(
Expand Down
89 changes: 62 additions & 27 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.9.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,7 +21,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.1"
charcode:
dependency: transitive
description:
Expand All @@ -35,14 +35,14 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
crypto:
dependency: transitive
description:
Expand All @@ -63,12 +63,19 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -80,56 +87,63 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
version: "0.13.5"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
lint:
dependency: "direct dev"
lints:
dependency: transitive
description:
name: lint
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
version: "2.0.1"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
version: "1.8.2"
plugin_platform_interface:
dependency: transitive
description:
name: pedantic
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
version: "2.1.3"
pointer_interceptor:
dependency: transitive
description:
name: pointer_interceptor
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0+1"
version: "0.9.3+3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -141,7 +155,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand All @@ -162,21 +176,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.4.12"
typed_data:
dependency: transitive
description:
Expand All @@ -190,28 +204,49 @@ packages:
name: uuid
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.4"
version: "3.0.7"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.2"
webview_flutter:
dependency: transitive
description:
name: webview_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
version: "3.0.4"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.10.4"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.5"
webviewx:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.2.1"
version: "0.3.0"
sdks:
dart: ">=2.13.0 <3.0.0"
flutter: ">=2.0.0"
dart: ">=2.17.0 <3.0.0"
flutter: ">=3.3.10"
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ description: A new Flutter project.

publish_to: "none"

version: 1.0.0+1
version: 1.0.0+2

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.13.0 <3.0.0"

dependencies:
cupertino_icons: ^1.0.3
Expand All @@ -19,7 +19,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
lint: ^1.5.3
flutter_lints: ^2.0.1

flutter:
uses-material-design: true
Expand Down
13 changes: 5 additions & 8 deletions lib/src/controller/impl/mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ 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/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;
import 'package:webviewx/src/utils/utils.dart';

/// Mobile implementation
class WebViewXController extends ChangeNotifier
Expand Down Expand Up @@ -80,10 +77,10 @@ class WebViewXController extends ChangeNotifier
bool fromAssets = false,
}) async {
if (fromAssets) {
final _content = await rootBundle.loadString(content);
final contentFromAssets = await rootBundle.loadString(content);

value = WebViewContent(
source: _content,
source: contentFromAssets,
sourceType: sourceType,
headers: headers,
);
Expand Down Expand Up @@ -121,7 +118,7 @@ class WebViewXController extends ChangeNotifier
) async {
// This basically will transform a "raw" call (evaluateJavascript)
// into a little bit more "typed" call, that is - calling a method.
final result = await connector.evaluateJavascript(
final result = await connector.runJavascriptReturningResult(
HtmlUtils.buildJsFunction(name, params),
);

Expand All @@ -144,7 +141,7 @@ class WebViewXController extends ChangeNotifier
String rawJavascript, {
bool inGlobalContext = false, // NO-OP HERE
}) {
return connector.evaluateJavascript(rawJavascript);
return connector.runJavascriptReturningResult(rawJavascript);
}

/// Returns the current content
Expand Down
8 changes: 3 additions & 5 deletions lib/src/controller/impl/web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ 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 @@ -89,10 +87,10 @@ class WebViewXController extends ChangeNotifier
WebViewContent newContent;

if (fromAssets) {
final _contentFromAssets = await rootBundle.loadString(content);
final contentFromAssets = await rootBundle.loadString(content);

newContent = WebViewContent(
source: _contentFromAssets,
source: contentFromAssets,
sourceType: sourceType,
headers: headers,
webPostRequestBody: body,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/embedded_js_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ class EmbeddedJsContent {
js != null || (js == null && mobileJs != null && webJs != null),
'Choose whether to use globally available js (like console.log), '
'or platform specific(functions, callbacks, etc; For this, you must fill in '
'the coresponding function for all platforms)',
'the corresponding function for all platforms)',
);
}
Loading