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/
.packages
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.
version: 1.0.0+1
publish_to: none
environment:
sdk: ">=2.14.0 <3.0.0"
flutter: ">=2.5.0"

View File

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

View File

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

View File

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

View File

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

View File

@ -203,11 +203,14 @@ class InAppWebViewController {
break;
case "onDownloadStartRequest":
if ((_webview != null &&
// ignore: deprecated_member_use_from_same_package
(_webview!.onDownloadStart != null || _webview!.onDownloadStartRequest != null)) ||
// ignore: deprecated_member_use_from_same_package
(_webview!.onDownloadStart != null ||
_webview!.onDownloadStartRequest != null)) ||
_inAppBrowser != null) {
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>();
DownloadStartRequest downloadStartRequest = DownloadStartRequest.fromMap(arguments)!;
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
DownloadStartRequest downloadStartRequest =
DownloadStartRequest.fromMap(arguments)!;
if (_webview != 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[]))
///- 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(
{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(iosAllowingReadAccessTo == null ||
iosAllowingReadAccessTo.isScheme("file"));
@ -1171,7 +1177,10 @@ class InAppWebViewController {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('urlRequest', () => urlRequest.toMap());
args.putIfAbsent(
'allowingReadAccessTo', () => allowingReadAccessTo?.toString() ?? iosAllowingReadAccessTo?.toString());
'allowingReadAccessTo',
() =>
allowingReadAccessTo?.toString() ??
iosAllowingReadAccessTo?.toString());
await _channel.invokeMethod('loadUrl', args);
}
@ -1215,10 +1224,10 @@ class InAppWebViewController {
String encoding = "utf8",
Uri? baseUrl,
@Deprecated('Use `historyUrl` instead')
Uri? androidHistoryUrl,
Uri? androidHistoryUrl,
Uri? historyUrl,
@Deprecated('Use `allowingReadAccessTo` instead')
Uri? iosAllowingReadAccessTo,
Uri? iosAllowingReadAccessTo,
Uri? allowingReadAccessTo}) async {
assert(iosAllowingReadAccessTo == null ||
iosAllowingReadAccessTo.isScheme("file"));
@ -1229,9 +1238,16 @@ class InAppWebViewController {
args.putIfAbsent('encoding', () => encoding);
args.putIfAbsent('baseUrl', () => baseUrl?.toString() ?? "about:blank");
args.putIfAbsent(
'historyUrl', () => historyUrl?.toString() ?? androidHistoryUrl?.toString() ?? "about:blank");
'historyUrl',
() =>
historyUrl?.toString() ??
androidHistoryUrl?.toString() ??
"about:blank");
args.putIfAbsent(
'allowingReadAccessTo', () => allowingReadAccessTo?.toString() ?? iosAllowingReadAccessTo?.toString());
'allowingReadAccessTo',
() =>
allowingReadAccessTo?.toString() ??
iosAllowingReadAccessTo?.toString());
await _channel.invokeMethod('loadData', args);
}
@ -1706,8 +1722,8 @@ class InAppWebViewController {
///- Android native WebView
///- iOS
Future<String> getTRexRunnerHtml() async {
return await rootBundle
.loadString("packages/flutter_inappwebview/assets/t_rex_runner/t-rex.html");
return await rootBundle.loadString(
"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].
@ -1716,8 +1732,8 @@ class InAppWebViewController {
///- Android native WebView
///- iOS
Future<String> getTRexRunnerCss() async {
return await rootBundle
.loadString("packages/flutter_inappwebview/assets/t_rex_runner/t-rex.css");
return await rootBundle.loadString(
"packages/flutter_inappwebview/assets/t_rex_runner/t-rex.css");
}
///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)))
///- iOS ([Official API - UIScrollView.setZoomScale](https://developer.apple.com/documentation/uikit/uiscrollview/1619412-setzoomscale))
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 ||
(defaultTargetPlatform == TargetPlatform.android &&
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 iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview
final void Function(InAppWebViewController controller, DownloadStartRequest downloadStartRequest)?
onDownloadStartRequest;
final void Function(InAppWebViewController controller,
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`.
///
@ -701,7 +701,8 @@ abstract class WebView {
this.shouldOverrideUrlLoading,
this.onLoadResource,
this.onScrollChanged,
@Deprecated('Use `onDownloadStartRequest` instead') this.onDownloadStart,
@Deprecated('Use `onDownloadStartRequest` instead')
this.onDownloadStart,
this.onDownloadStartRequest,
this.onLoadResourceCustomScheme,
this.onCreateWindow,
@ -738,7 +739,7 @@ abstract class WebView {
this.androidOnRenderProcessUnresponsive,
this.androidOnFormResubmission,
@Deprecated('Use `onZoomScaleChanged` instead')
this.androidOnScaleChanged,
this.androidOnScaleChanged,
this.androidOnReceivedIcon,
this.androidOnReceivedTouchIconUrl,
this.androidOnJsBeforeUnload,

View File

@ -6857,9 +6857,8 @@ class WebViewImplementation {
const WebViewImplementation._internal(this._value);
static final Set<WebViewImplementation> values = [
WebViewImplementation.NATIVE
].toSet();
static final Set<WebViewImplementation> values =
[WebViewImplementation.NATIVE].toSet();
static WebViewImplementation? fromValue(int? value) {
if (value != null) {
@ -6918,12 +6917,12 @@ class DownloadStartRequest {
DownloadStartRequest(
{required this.url,
this.userAgent,
this.contentDisposition,
this.mimeType,
required this.contentLength,
this.suggestedFilename,
this.textEncodingName});
this.userAgent,
this.contentDisposition,
this.mimeType,
required this.contentLength,
this.suggestedFilename,
this.textEncodingName});
static DownloadStartRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
@ -7034,14 +7033,12 @@ abstract class TrustedWebActivityDisplayMode {
///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.
class TrustedWebActivityDefaultDisplayMode implements TrustedWebActivityDisplayMode {
class TrustedWebActivityDefaultDisplayMode
implements TrustedWebActivityDisplayMode {
String _type = "DEFAULT_MODE";
Map<String, dynamic> toMap() {
return {
"type": _type
};
return {"type": _type};
}
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.
///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.
bool isSticky;
@ -7066,10 +7064,10 @@ class TrustedWebActivityImmersiveDisplayMode implements TrustedWebActivityDispla
String _type = "IMMERSIVE_MODE";
TrustedWebActivityImmersiveDisplayMode(
{required this.isSticky,
required this.layoutInDisplayCutoutMode});
{required this.isSticky, required this.layoutInDisplayCutoutMode});
static TrustedWebActivityImmersiveDisplayMode? fromMap(Map<String, dynamic>? map) {
static TrustedWebActivityImmersiveDisplayMode? fromMap(
Map<String, dynamic>? map) {
if (map == null) {
return null;
}
@ -7149,7 +7147,8 @@ class AndroidLayoutInDisplayCutoutMode {
///Content renders into the cutout area in both portrait and landscape modes.
///
///**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.
///
@ -7232,22 +7231,26 @@ class TrustedWebActivityScreenOrientation {
/// 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
/// 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
/// screen height. If the device's natural orientation is portrait, then it is in
/// 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.
/// If the device's natural orientation is landscape, then it is in landscape-primary when held
/// 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
/// screen height. If the device's natural orientation is landscape, it is in
/// 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,
/// 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
/// depending on platform convention locking the screen to landscape can represent
/// 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
/// and depending on platform convention locking the screen to portrait can represent
/// 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
/// depending on the device's usual orientation. This orientation is usually provided by

View File

@ -62,3 +62,7 @@ flutter:
#
# For details regarding fonts in packages, see
# 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)