dartfmt, fixed pubspec.yaml

This commit is contained in:
Lorenzo Pichilli 2022-04-19 00:42:57 +02:00
parent 254ba1a1b8
commit 7307d473fa
13 changed files with 100 additions and 59 deletions

View File

@ -1 +0,0 @@
/Users/lorenzopichilli/fvm/versions/2.10.4

View File

@ -1,4 +0,0 @@
{
"flutterSdkVersion": "2.10.4",
"flavors": {}
}

3
.gitignore vendored
View File

@ -27,3 +27,6 @@
.dart_tool/ .dart_tool/
.packages .packages
build/ build/
.fvm/
flutter_driver_tests.log

View File

@ -9,6 +9,8 @@ description: Demonstrates how to use the flutter_inappwebview plugin.
# Read more about versioning at semver.org. # Read more about versioning at semver.org.
version: 1.0.0+1 version: 1.0.0+1
publish_to: none
environment: environment:
sdk: ">=2.14.0 <3.0.0" sdk: ">=2.14.0 <3.0.0"
flutter: ">=2.5.0" flutter: ">=2.5.0"

View File

@ -126,9 +126,10 @@ class AndroidChromeCustomTabsOptions
options.noHistory = map["noHistory"]; options.noHistory = map["noHistory"];
options.isTrustedWebActivity = map["isTrustedWebActivity"]; options.isTrustedWebActivity = map["isTrustedWebActivity"];
options.additionalTrustedOrigins = map["additionalTrustedOrigins"]; options.additionalTrustedOrigins = map["additionalTrustedOrigins"];
switch(map["displayMode"]["type"]) { switch (map["displayMode"]["type"]) {
case "IMMERSIVE_MODE": case "IMMERSIVE_MODE":
options.displayMode = TrustedWebActivityImmersiveDisplayMode.fromMap(map["displayMode"]); options.displayMode =
TrustedWebActivityImmersiveDisplayMode.fromMap(map["displayMode"]);
break; break;
case "DEFAULT_MODE": case "DEFAULT_MODE":
default: default:

View File

@ -69,7 +69,10 @@ class InAppBrowser {
final WebViewImplementation implementation; final WebViewImplementation implementation;
/// ///
InAppBrowser({this.windowId, this.initialUserScripts, this.implementation = WebViewImplementation.NATIVE}) { InAppBrowser(
{this.windowId,
this.initialUserScripts,
this.implementation = WebViewImplementation.NATIVE}) {
id = IdGenerator.generate(); id = IdGenerator.generate();
this._channel = this._channel =
MethodChannel('com.pichillilorenzo/flutter_inappbrowser_$id'); MethodChannel('com.pichillilorenzo/flutter_inappbrowser_$id');

View File

@ -64,7 +64,8 @@ class HeadlessInAppWebView implements WebView {
this.shouldOverrideUrlLoading, this.shouldOverrideUrlLoading,
this.onLoadResource, this.onLoadResource,
this.onScrollChanged, this.onScrollChanged,
@Deprecated('Use `onDownloadStartRequest` instead') this.onDownloadStart, @Deprecated('Use `onDownloadStartRequest` instead')
this.onDownloadStart,
this.onDownloadStartRequest, this.onDownloadStartRequest,
this.onLoadResourceCustomScheme, this.onLoadResourceCustomScheme,
this.onCreateWindow, this.onCreateWindow,
@ -306,11 +307,11 @@ class HeadlessInAppWebView implements WebView {
@Deprecated('Use `onDownloadStartRequest` instead') @Deprecated('Use `onDownloadStartRequest` instead')
@override @override
final void Function(InAppWebViewController controller, Uri url)? final void Function(InAppWebViewController controller, Uri url)?
onDownloadStart; onDownloadStart;
@override @override
final void Function(InAppWebViewController controller, DownloadStartRequest downloadStartRequest)? final void Function(InAppWebViewController controller,
onDownloadStartRequest; DownloadStartRequest downloadStartRequest)? onDownloadStartRequest;
@override @override
void Function(InAppWebViewController controller, int activeMatchOrdinal, void Function(InAppWebViewController controller, int activeMatchOrdinal,

View File

@ -219,8 +219,8 @@ class InAppWebView extends StatefulWidget implements WebView {
onDownloadStart; onDownloadStart;
@override @override
final void Function(InAppWebViewController controller, DownloadStartRequest downloadStartRequest)? final void Function(InAppWebViewController controller,
onDownloadStartRequest; DownloadStartRequest downloadStartRequest)? onDownloadStartRequest;
@override @override
final void Function(InAppWebViewController controller, int activeMatchOrdinal, final void Function(InAppWebViewController controller, int activeMatchOrdinal,

View File

@ -203,11 +203,14 @@ class InAppWebViewController {
break; break;
case "onDownloadStartRequest": case "onDownloadStartRequest":
if ((_webview != null && if ((_webview != null &&
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
(_webview!.onDownloadStart != null || _webview!.onDownloadStartRequest != null)) || (_webview!.onDownloadStart != null ||
_webview!.onDownloadStartRequest != null)) ||
_inAppBrowser != null) { _inAppBrowser != null) {
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); Map<String, dynamic> arguments =
DownloadStartRequest downloadStartRequest = DownloadStartRequest.fromMap(arguments)!; call.arguments.cast<String, dynamic>();
DownloadStartRequest downloadStartRequest =
DownloadStartRequest.fromMap(arguments)!;
if (_webview != null) { if (_webview != null) {
if (_webview!.onDownloadStartRequest != null) if (_webview!.onDownloadStartRequest != null)
@ -1163,7 +1166,10 @@ class InAppWebViewController {
///- Android native WebView ([Official API - WebView.loadUrl](https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String))). If method is "POST", [Official API - WebView.postUrl](https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[])) ///- Android native WebView ([Official API - WebView.loadUrl](https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String))). If method is "POST", [Official API - WebView.postUrl](https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[]))
///- iOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load). If [allowingReadAccessTo] is used, [Official API - WKWebView.loadFileURL](https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl)) ///- iOS ([Official API - WKWebView.load](https://developer.apple.com/documentation/webkit/wkwebview/1414954-load). If [allowingReadAccessTo] is used, [Official API - WKWebView.loadFileURL](https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl))
Future<void> loadUrl( Future<void> loadUrl(
{required URLRequest urlRequest, @Deprecated('Use `allowingReadAccessTo` instead') Uri? iosAllowingReadAccessTo, Uri? allowingReadAccessTo}) async { {required URLRequest urlRequest,
@Deprecated('Use `allowingReadAccessTo` instead')
Uri? iosAllowingReadAccessTo,
Uri? allowingReadAccessTo}) async {
assert(urlRequest.url != null && urlRequest.url.toString().isNotEmpty); assert(urlRequest.url != null && urlRequest.url.toString().isNotEmpty);
assert(iosAllowingReadAccessTo == null || assert(iosAllowingReadAccessTo == null ||
iosAllowingReadAccessTo.isScheme("file")); iosAllowingReadAccessTo.isScheme("file"));
@ -1171,7 +1177,10 @@ class InAppWebViewController {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('urlRequest', () => urlRequest.toMap()); args.putIfAbsent('urlRequest', () => urlRequest.toMap());
args.putIfAbsent( args.putIfAbsent(
'allowingReadAccessTo', () => allowingReadAccessTo?.toString() ?? iosAllowingReadAccessTo?.toString()); 'allowingReadAccessTo',
() =>
allowingReadAccessTo?.toString() ??
iosAllowingReadAccessTo?.toString());
await _channel.invokeMethod('loadUrl', args); await _channel.invokeMethod('loadUrl', args);
} }
@ -1215,10 +1224,10 @@ class InAppWebViewController {
String encoding = "utf8", String encoding = "utf8",
Uri? baseUrl, Uri? baseUrl,
@Deprecated('Use `historyUrl` instead') @Deprecated('Use `historyUrl` instead')
Uri? androidHistoryUrl, Uri? androidHistoryUrl,
Uri? historyUrl, Uri? historyUrl,
@Deprecated('Use `allowingReadAccessTo` instead') @Deprecated('Use `allowingReadAccessTo` instead')
Uri? iosAllowingReadAccessTo, Uri? iosAllowingReadAccessTo,
Uri? allowingReadAccessTo}) async { Uri? allowingReadAccessTo}) async {
assert(iosAllowingReadAccessTo == null || assert(iosAllowingReadAccessTo == null ||
iosAllowingReadAccessTo.isScheme("file")); iosAllowingReadAccessTo.isScheme("file"));
@ -1229,9 +1238,16 @@ class InAppWebViewController {
args.putIfAbsent('encoding', () => encoding); args.putIfAbsent('encoding', () => encoding);
args.putIfAbsent('baseUrl', () => baseUrl?.toString() ?? "about:blank"); args.putIfAbsent('baseUrl', () => baseUrl?.toString() ?? "about:blank");
args.putIfAbsent( args.putIfAbsent(
'historyUrl', () => historyUrl?.toString() ?? androidHistoryUrl?.toString() ?? "about:blank"); 'historyUrl',
() =>
historyUrl?.toString() ??
androidHistoryUrl?.toString() ??
"about:blank");
args.putIfAbsent( args.putIfAbsent(
'allowingReadAccessTo', () => allowingReadAccessTo?.toString() ?? iosAllowingReadAccessTo?.toString()); 'allowingReadAccessTo',
() =>
allowingReadAccessTo?.toString() ??
iosAllowingReadAccessTo?.toString());
await _channel.invokeMethod('loadData', args); await _channel.invokeMethod('loadData', args);
} }
@ -1706,8 +1722,8 @@ class InAppWebViewController {
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
Future<String> getTRexRunnerHtml() async { Future<String> getTRexRunnerHtml() async {
return await rootBundle return await rootBundle.loadString(
.loadString("packages/flutter_inappwebview/assets/t_rex_runner/t-rex.html"); "packages/flutter_inappwebview/assets/t_rex_runner/t-rex.html");
} }
///Gets the css of the Chromium's t-rex runner game. Used in combination with [getTRexRunnerHtml]. ///Gets the css of the Chromium's t-rex runner game. Used in combination with [getTRexRunnerHtml].
@ -1716,8 +1732,8 @@ class InAppWebViewController {
///- Android native WebView ///- Android native WebView
///- iOS ///- iOS
Future<String> getTRexRunnerCss() async { Future<String> getTRexRunnerCss() async {
return await rootBundle return await rootBundle.loadString(
.loadString("packages/flutter_inappwebview/assets/t_rex_runner/t-rex.css"); "packages/flutter_inappwebview/assets/t_rex_runner/t-rex.css");
} }
///Scrolls the WebView to the position. ///Scrolls the WebView to the position.
@ -1820,7 +1836,9 @@ class InAppWebViewController {
///- Android native WebView ([Official API - WebView.zoomBy](https://developer.android.com/reference/android/webkit/WebView#zoomBy(float))) ///- Android native WebView ([Official API - WebView.zoomBy](https://developer.android.com/reference/android/webkit/WebView#zoomBy(float)))
///- iOS ([Official API - UIScrollView.setZoomScale](https://developer.apple.com/documentation/uikit/uiscrollview/1619412-setzoomscale)) ///- iOS ([Official API - UIScrollView.setZoomScale](https://developer.apple.com/documentation/uikit/uiscrollview/1619412-setzoomscale))
Future<void> zoomBy( Future<void> zoomBy(
{required double zoomFactor, @Deprecated('Use `animated` instead') bool? iosAnimated, bool animated = false}) async { {required double zoomFactor,
@Deprecated('Use `animated` instead') bool? iosAnimated,
bool animated = false}) async {
assert(defaultTargetPlatform != TargetPlatform.android || assert(defaultTargetPlatform != TargetPlatform.android ||
(defaultTargetPlatform == TargetPlatform.android && (defaultTargetPlatform == TargetPlatform.android &&
zoomFactor > 0.01 && zoomFactor > 0.01 &&

View File

@ -127,8 +127,8 @@ abstract class WebView {
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener)
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview
final void Function(InAppWebViewController controller, DownloadStartRequest downloadStartRequest)? final void Function(InAppWebViewController controller,
onDownloadStartRequest; DownloadStartRequest downloadStartRequest)? onDownloadStartRequest;
///Event fired when the [WebView] finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`. ///Event fired when the [WebView] finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`.
/// ///
@ -701,7 +701,8 @@ abstract class WebView {
this.shouldOverrideUrlLoading, this.shouldOverrideUrlLoading,
this.onLoadResource, this.onLoadResource,
this.onScrollChanged, this.onScrollChanged,
@Deprecated('Use `onDownloadStartRequest` instead') this.onDownloadStart, @Deprecated('Use `onDownloadStartRequest` instead')
this.onDownloadStart,
this.onDownloadStartRequest, this.onDownloadStartRequest,
this.onLoadResourceCustomScheme, this.onLoadResourceCustomScheme,
this.onCreateWindow, this.onCreateWindow,
@ -738,7 +739,7 @@ abstract class WebView {
this.androidOnRenderProcessUnresponsive, this.androidOnRenderProcessUnresponsive,
this.androidOnFormResubmission, this.androidOnFormResubmission,
@Deprecated('Use `onZoomScaleChanged` instead') @Deprecated('Use `onZoomScaleChanged` instead')
this.androidOnScaleChanged, this.androidOnScaleChanged,
this.androidOnReceivedIcon, this.androidOnReceivedIcon,
this.androidOnReceivedTouchIconUrl, this.androidOnReceivedTouchIconUrl,
this.androidOnJsBeforeUnload, this.androidOnJsBeforeUnload,

View File

@ -6857,9 +6857,8 @@ class WebViewImplementation {
const WebViewImplementation._internal(this._value); const WebViewImplementation._internal(this._value);
static final Set<WebViewImplementation> values = [ static final Set<WebViewImplementation> values =
WebViewImplementation.NATIVE [WebViewImplementation.NATIVE].toSet();
].toSet();
static WebViewImplementation? fromValue(int? value) { static WebViewImplementation? fromValue(int? value) {
if (value != null) { if (value != null) {
@ -6918,12 +6917,12 @@ class DownloadStartRequest {
DownloadStartRequest( DownloadStartRequest(
{required this.url, {required this.url,
this.userAgent, this.userAgent,
this.contentDisposition, this.contentDisposition,
this.mimeType, this.mimeType,
required this.contentLength, required this.contentLength,
this.suggestedFilename, this.suggestedFilename,
this.textEncodingName}); this.textEncodingName});
static DownloadStartRequest? fromMap(Map<String, dynamic>? map) { static DownloadStartRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) { if (map == null) {
@ -7034,14 +7033,12 @@ abstract class TrustedWebActivityDisplayMode {
///Android-class that represents the default display mode of a Trusted Web Activity. ///Android-class that represents the default display mode of a Trusted Web Activity.
///The system UI (status bar, navigation bar) is shown, and the browser toolbar is hidden while the user is on a verified origin. ///The system UI (status bar, navigation bar) is shown, and the browser toolbar is hidden while the user is on a verified origin.
class TrustedWebActivityDefaultDisplayMode implements TrustedWebActivityDisplayMode { class TrustedWebActivityDefaultDisplayMode
implements TrustedWebActivityDisplayMode {
String _type = "DEFAULT_MODE"; String _type = "DEFAULT_MODE";
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {"type": _type};
"type": _type
};
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -7056,7 +7053,8 @@ class TrustedWebActivityDefaultDisplayMode implements TrustedWebActivityDisplayM
///Android-class that represents the default display mode of a Trusted Web Activity. ///Android-class that represents the default display mode of a Trusted Web Activity.
///The system UI (status bar, navigation bar) is shown, and the browser toolbar is hidden while the user is on a verified origin. ///The system UI (status bar, navigation bar) is shown, and the browser toolbar is hidden while the user is on a verified origin.
class TrustedWebActivityImmersiveDisplayMode implements TrustedWebActivityDisplayMode { class TrustedWebActivityImmersiveDisplayMode
implements TrustedWebActivityDisplayMode {
///Whether the Trusted Web Activity should be in sticky immersive mode. ///Whether the Trusted Web Activity should be in sticky immersive mode.
bool isSticky; bool isSticky;
@ -7066,10 +7064,10 @@ class TrustedWebActivityImmersiveDisplayMode implements TrustedWebActivityDispla
String _type = "IMMERSIVE_MODE"; String _type = "IMMERSIVE_MODE";
TrustedWebActivityImmersiveDisplayMode( TrustedWebActivityImmersiveDisplayMode(
{required this.isSticky, {required this.isSticky, required this.layoutInDisplayCutoutMode});
required this.layoutInDisplayCutoutMode});
static TrustedWebActivityImmersiveDisplayMode? fromMap(Map<String, dynamic>? map) { static TrustedWebActivityImmersiveDisplayMode? fromMap(
Map<String, dynamic>? map) {
if (map == null) { if (map == null) {
return null; return null;
} }
@ -7149,7 +7147,8 @@ class AndroidLayoutInDisplayCutoutMode {
///Content renders into the cutout area in both portrait and landscape modes. ///Content renders into the cutout area in both portrait and landscape modes.
/// ///
///**NOTE**: available on Android 28+. ///**NOTE**: available on Android 28+.
static const SHORT_EDGES = const AndroidLayoutInDisplayCutoutMode._internal(1); static const SHORT_EDGES =
const AndroidLayoutInDisplayCutoutMode._internal(1);
///Content never renders into the cutout area. ///Content never renders into the cutout area.
/// ///
@ -7232,22 +7231,26 @@ class TrustedWebActivityScreenOrientation {
/// Portrait-primary is an orientation where the screen width is less than or equal to the /// Portrait-primary is an orientation where the screen width is less than or equal to the
/// screen height. If the device's natural orientation is portrait, then it is in /// screen height. If the device's natural orientation is portrait, then it is in
/// portrait-primary when held in that position. /// portrait-primary when held in that position.
static const PORTRAIT_PRIMARY = const TrustedWebActivityScreenOrientation._internal(1); static const PORTRAIT_PRIMARY =
const TrustedWebActivityScreenOrientation._internal(1);
/// Portrait-secondary is an orientation where the screen width is less than or equal to the /// Portrait-secondary is an orientation where the screen width is less than or equal to the
/// screen height. If the device's natural orientation is portrait, then it is in /// screen height. If the device's natural orientation is portrait, then it is in
/// portrait-secondary when rotated 180° from its natural position. /// portrait-secondary when rotated 180° from its natural position.
static const PORTRAIT_SECONDARY = const TrustedWebActivityScreenOrientation._internal(2); static const PORTRAIT_SECONDARY =
const TrustedWebActivityScreenOrientation._internal(2);
/// Landscape-primary is an orientation where the screen width is greater than the screen height. /// Landscape-primary is an orientation where the screen width is greater than the screen height.
/// If the device's natural orientation is landscape, then it is in landscape-primary when held /// If the device's natural orientation is landscape, then it is in landscape-primary when held
/// in that position. /// in that position.
static const LANDSCAPE_PRIMARY = const TrustedWebActivityScreenOrientation._internal(3); static const LANDSCAPE_PRIMARY =
const TrustedWebActivityScreenOrientation._internal(3);
/// Landscape-secondary is an orientation where the screen width is greater than the /// Landscape-secondary is an orientation where the screen width is greater than the
/// screen height. If the device's natural orientation is landscape, it is in /// screen height. If the device's natural orientation is landscape, it is in
/// landscape-secondary when rotated 180° from its natural orientation. /// landscape-secondary when rotated 180° from its natural orientation.
static const LANDSCAPE_SECONDARY = const TrustedWebActivityScreenOrientation._internal(4); static const LANDSCAPE_SECONDARY =
const TrustedWebActivityScreenOrientation._internal(4);
/// Any is an orientation that means the screen can be locked to any one of portrait-primary, /// Any is an orientation that means the screen can be locked to any one of portrait-primary,
/// portrait-secondary, landscape-primary and landscape-secondary. /// portrait-secondary, landscape-primary and landscape-secondary.
@ -7256,12 +7259,14 @@ class TrustedWebActivityScreenOrientation {
/// Landscape is an orientation where the screen width is greater than the screen height and /// Landscape is an orientation where the screen width is greater than the screen height and
/// depending on platform convention locking the screen to landscape can represent /// depending on platform convention locking the screen to landscape can represent
/// landscape-primary, landscape-secondary or both. /// landscape-primary, landscape-secondary or both.
static const LANDSCAPE = const TrustedWebActivityScreenOrientation._internal(6); static const LANDSCAPE =
const TrustedWebActivityScreenOrientation._internal(6);
/// Portrait is an orientation where the screen width is less than or equal to the screen height /// Portrait is an orientation where the screen width is less than or equal to the screen height
/// and depending on platform convention locking the screen to portrait can represent /// and depending on platform convention locking the screen to portrait can represent
/// portrait-primary, portrait-secondary or both. /// portrait-primary, portrait-secondary or both.
static const PORTRAIT = const TrustedWebActivityScreenOrientation._internal(7); static const PORTRAIT =
const TrustedWebActivityScreenOrientation._internal(7);
/// Natural is an orientation that refers to either portrait-primary or landscape-primary /// Natural is an orientation that refers to either portrait-primary or landscape-primary
/// depending on the device's usual orientation. This orientation is usually provided by /// depending on the device's usual orientation. This orientation is usually provided by
@ -7272,4 +7277,4 @@ class TrustedWebActivityScreenOrientation {
@override @override
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }

View File

@ -62,3 +62,7 @@ flutter:
# #
# For details regarding fonts in packages, see # For details regarding fonts in packages, see
# https://flutter.io/custom-fonts/#from-packages # https://flutter.io/custom-fonts/#from-packages
false_secrets:
- /nodejs_server_test_auth_basic_and_ssl/*.pem
- /nodejs_server_test_auth_basic_and_ssl/*.pfx

8
scripts/test_and_log.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
readonly SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
readonly PROJECT_DIR="$(dirname $SCRIPT_PATH)"
$SCRIPT_PATH/test.sh $1 2>&1 | tee $PROJECT_DIR/flutter_driver_tests.log
kill $(jobs -p)