Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
pichillilorenzo committed Nov 26, 2024
1 parent c82ece1 commit f5a42f2
Show file tree
Hide file tree
Showing 56 changed files with 684 additions and 881 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ class InAppBrowser implements PlatformInAppBrowserEvents {
}

@override
FutureOr<AjaxRequestAction?>? onAjaxReadyStateChange(AjaxRequest ajaxRequest) {
FutureOr<AjaxRequestAction?>? onAjaxReadyStateChange(
AjaxRequest ajaxRequest) {
return null;
}

Expand Down Expand Up @@ -363,7 +364,8 @@ class InAppBrowser implements PlatformInAppBrowserEvents {
void onDownloadStartRequest(DownloadStartRequest downloadStartRequest) {}

@override
FutureOr<DownloadStartResponse?>? onDownloadStarting(DownloadStartRequest downloadStartRequest) {
FutureOr<DownloadStartResponse?>? onDownloadStarting(
DownloadStartRequest downloadStartRequest) {
return null;
}

Expand Down Expand Up @@ -529,7 +531,8 @@ class InAppBrowser implements PlatformInAppBrowserEvents {
void onRenderProcessGone(RenderProcessGoneDetail detail) {}

@override
FutureOr<WebViewRenderProcessAction?>? onRenderProcessResponsive(WebUri? url) {
FutureOr<WebViewRenderProcessAction?>? onRenderProcessResponsive(
WebUri? url) {
return null;
}

Expand Down
408 changes: 136 additions & 272 deletions flutter_inappwebview/lib/src/in_app_webview/headless_in_app_webview.dart

Large diffs are not rendered by default.

409 changes: 137 additions & 272 deletions flutter_inappwebview/lib/src/in_app_webview/in_app_webview.dart

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ class InAppWebViewController {
Future<void> clearFocus() => platform.clearFocus();

///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.setInputMethodEnabled}
Future<void> setInputMethodEnabled(bool enabled) => platform.setInputMethodEnabled(enabled);
Future<void> setInputMethodEnabled(bool enabled) =>
platform.setInputMethodEnabled(enabled);

///{@macro flutter_inappwebview_platform_interface.PlatformInAppWebViewController.showInputMethod}
Future<void> showInputMethod() => platform.showInputMethod();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class WebMessagePort implements IWebMessagePort {
///{@macro flutter_inappwebview_platform_interface.PlatformWebMessagePort.close}
Future<void> close() => platform.close();

Map<String, dynamic> toMap({EnumMethod? enumMethod}) => platform.toMap(enumMethod: enumMethod);
Map<String, dynamic> toMap({EnumMethod? enumMethod}) =>
platform.toMap(enumMethod: enumMethod);

Map<String, dynamic> toJson() => platform.toJson();

Expand Down
3 changes: 2 additions & 1 deletion flutter_inappwebview/lib/src/webview_asset_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ abstract class PathHandler
}

@override
Map<String, dynamic> toMap({EnumMethod? enumMethod}) => platform.toMap(enumMethod: enumMethod);
Map<String, dynamic> toMap({EnumMethod? enumMethod}) =>
platform.toMap(enumMethod: enumMethod);

@override
Map<String, dynamic> toJson() => platform.toJson();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,24 @@ class WebViewEnvironment {
.compareBrowserVersions(version1: version1, version2: version2);

///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.onNewBrowserVersionAvailable}
void Function()? get onNewBrowserVersionAvailable => platform.onNewBrowserVersionAvailable;
set onNewBrowserVersionAvailable(void Function()? value) => platform.onNewBrowserVersionAvailable = value;
void Function()? get onNewBrowserVersionAvailable =>
platform.onNewBrowserVersionAvailable;
set onNewBrowserVersionAvailable(void Function()? value) =>
platform.onNewBrowserVersionAvailable = value;

///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.onBrowserProcessExited}
void Function(BrowserProcessExitedDetail detail)? get onBrowserProcessExited => platform.onBrowserProcessExited;
set onBrowserProcessExited(void Function(BrowserProcessExitedDetail detail)? value) => platform.onBrowserProcessExited = value;
void Function(BrowserProcessExitedDetail detail)?
get onBrowserProcessExited => platform.onBrowserProcessExited;
set onBrowserProcessExited(
void Function(BrowserProcessExitedDetail detail)? value) =>
platform.onBrowserProcessExited = value;

///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.onProcessInfosChanged}
void Function(BrowserProcessInfosChangedDetail detail)? get onProcessInfosChanged => platform.onProcessInfosChanged;
set onProcessInfosChanged(void Function(BrowserProcessInfosChangedDetail detail)? value) => platform.onProcessInfosChanged = value;
void Function(BrowserProcessInfosChangedDetail detail)?
get onProcessInfosChanged => platform.onProcessInfosChanged;
set onProcessInfosChanged(
void Function(BrowserProcessInfosChangedDetail detail)? value) =>
platform.onProcessInfosChanged = value;

///{@macro flutter_inappwebview_platform_interface.PlatformWebViewEnvironment.dispose}
Future<void> dispose() => platform.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class AndroidHeadlessInAppWebViewCreationParams
super.onLoadResource,
super.onScrollChanged,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStart,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStartRequest,
@Deprecated('Use onDownloadStarting instead')
super.onDownloadStartRequest,
super.onDownloadStarting,
@Deprecated('Use onLoadResourceWithCustomScheme instead')
super.onLoadResourceCustomScheme,
Expand Down Expand Up @@ -362,7 +363,8 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView
if (params.onLoadResource != null && settings.useOnLoadResource == null) {
settings.useOnLoadResource = true;
}
if ((params.onDownloadStartRequest != null || params.onDownloadStarting != null) &&
if ((params.onDownloadStartRequest != null ||
params.onDownloadStarting != null) &&
settings.useOnDownloadStart == null) {
settings.useOnDownloadStart = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class AndroidInAppWebViewWidgetCreationParams
super.onLoadResource,
super.onScrollChanged,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStart,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStartRequest,
@Deprecated('Use onDownloadStarting instead')
super.onDownloadStartRequest,
super.onDownloadStarting,
@Deprecated('Use onLoadResourceWithCustomScheme instead')
super.onLoadResourceCustomScheme,
Expand Down Expand Up @@ -424,7 +425,8 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
if (params.onLoadResource != null && settings.useOnLoadResource == null) {
settings.useOnLoadResource = true;
}
if ((params.onDownloadStartRequest != null || params.onDownloadStarting != null) &&
if ((params.onDownloadStartRequest != null ||
params.onDownloadStarting != null) &&
settings.useOnDownloadStart == null) {
settings.useOnDownloadStart = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,19 +346,20 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
break;
case "onDownloadStarting":
if ((webviewParams != null &&
(webviewParams!.onDownloadStart != null ||
webviewParams!.onDownloadStartRequest != null ||
webviewParams!.onDownloadStarting != null)) ||
(webviewParams!.onDownloadStart != null ||
webviewParams!.onDownloadStartRequest != null ||
webviewParams!.onDownloadStarting != null)) ||
_inAppBrowserEventHandler != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
call.arguments.cast<String, dynamic>();
DownloadStartRequest downloadStartRequest =
DownloadStartRequest.fromMap(arguments)!;
DownloadStartRequest.fromMap(arguments)!;

if (webviewParams != null) {
if (webviewParams!.onDownloadStarting != null)
return (await webviewParams!.onDownloadStarting!(
_controllerFromPlatform, downloadStartRequest))?.toMap();
_controllerFromPlatform, downloadStartRequest))
?.toMap();
else if (webviewParams!.onDownloadStartRequest != null)
webviewParams!.onDownloadStartRequest!(
_controllerFromPlatform, downloadStartRequest);
Expand All @@ -372,7 +373,8 @@ class AndroidInAppWebViewController extends PlatformInAppWebViewController
_inAppBrowserEventHandler!
.onDownloadStartRequest(downloadStartRequest);
return (await _inAppBrowserEventHandler!
.onDownloadStarting(downloadStartRequest))?.toMap();
.onDownloadStarting(downloadStartRequest))
?.toMap();
}
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class IOSHeadlessInAppWebViewCreationParams
super.onLoadResource,
super.onScrollChanged,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStart,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStartRequest,
@Deprecated('Use onDownloadStarting instead')
super.onDownloadStartRequest,
super.onDownloadStarting,
@Deprecated('Use onLoadResourceWithCustomScheme instead')
super.onLoadResourceCustomScheme,
Expand Down Expand Up @@ -361,7 +362,8 @@ class IOSHeadlessInAppWebView extends PlatformHeadlessInAppWebView
if (params.onLoadResource != null && settings.useOnLoadResource == null) {
settings.useOnLoadResource = true;
}
if ((params.onDownloadStartRequest != null || params.onDownloadStarting != null) &&
if ((params.onDownloadStartRequest != null ||
params.onDownloadStarting != null) &&
settings.useOnDownloadStart == null) {
settings.useOnDownloadStart = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class IOSInAppWebViewWidgetCreationParams
super.onLoadResource,
super.onScrollChanged,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStart,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStartRequest,
@Deprecated('Use onDownloadStarting instead')
super.onDownloadStartRequest,
super.onDownloadStarting,
@Deprecated('Use onLoadResourceWithCustomScheme instead')
super.onLoadResourceCustomScheme,
Expand Down Expand Up @@ -365,7 +366,8 @@ class IOSInAppWebViewWidget extends PlatformInAppWebViewWidget {
if (params.onLoadResource != null && settings.useOnLoadResource == null) {
settings.useOnLoadResource = true;
}
if ((params.onDownloadStartRequest != null || params.onDownloadStarting != null) &&
if ((params.onDownloadStartRequest != null ||
params.onDownloadStarting != null) &&
settings.useOnDownloadStart == null) {
settings.useOnDownloadStart = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,19 +342,20 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController
break;
case "onDownloadStarting":
if ((webviewParams != null &&
(webviewParams!.onDownloadStart != null ||
webviewParams!.onDownloadStartRequest != null ||
webviewParams!.onDownloadStarting != null)) ||
(webviewParams!.onDownloadStart != null ||
webviewParams!.onDownloadStartRequest != null ||
webviewParams!.onDownloadStarting != null)) ||
_inAppBrowserEventHandler != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
call.arguments.cast<String, dynamic>();
DownloadStartRequest downloadStartRequest =
DownloadStartRequest.fromMap(arguments)!;
DownloadStartRequest.fromMap(arguments)!;

if (webviewParams != null) {
if (webviewParams!.onDownloadStarting != null)
return (await webviewParams!.onDownloadStarting!(
_controllerFromPlatform, downloadStartRequest))?.toMap();
_controllerFromPlatform, downloadStartRequest))
?.toMap();
else if (webviewParams!.onDownloadStartRequest != null)
webviewParams!.onDownloadStartRequest!(
_controllerFromPlatform, downloadStartRequest);
Expand All @@ -368,7 +369,8 @@ class IOSInAppWebViewController extends PlatformInAppWebViewController
_inAppBrowserEventHandler!
.onDownloadStartRequest(downloadStartRequest);
return (await _inAppBrowserEventHandler!
.onDownloadStarting(downloadStartRequest))?.toMap();
.onDownloadStarting(downloadStartRequest))
?.toMap();
}
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class MacOSHeadlessInAppWebViewCreationParams
super.onLoadResource,
super.onScrollChanged,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStart,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStartRequest,
@Deprecated('Use onDownloadStarting instead')
super.onDownloadStartRequest,
super.onDownloadStarting,
@Deprecated('Use onLoadResourceWithCustomScheme instead')
super.onLoadResourceCustomScheme,
Expand Down Expand Up @@ -355,7 +356,8 @@ class MacOSHeadlessInAppWebView extends PlatformHeadlessInAppWebView
if (params.onLoadResource != null && settings.useOnLoadResource == null) {
settings.useOnLoadResource = true;
}
if ((params.onDownloadStartRequest != null || params.onDownloadStarting != null) &&
if ((params.onDownloadStartRequest != null ||
params.onDownloadStarting != null) &&
settings.useOnDownloadStart == null) {
settings.useOnDownloadStart = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class MacOSInAppWebViewWidgetCreationParams
super.onLoadResource,
super.onScrollChanged,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStart,
@Deprecated('Use onDownloadStarting instead') super.onDownloadStartRequest,
@Deprecated('Use onDownloadStarting instead')
super.onDownloadStartRequest,
super.onDownloadStarting,
@Deprecated('Use onLoadResourceWithCustomScheme instead')
super.onLoadResourceCustomScheme,
Expand Down Expand Up @@ -358,7 +359,8 @@ class MacOSInAppWebViewWidget extends PlatformInAppWebViewWidget {
if (params.onLoadResource != null && settings.useOnLoadResource == null) {
settings.useOnLoadResource = true;
}
if ((params.onDownloadStartRequest != null || params.onDownloadStarting != null) &&
if ((params.onDownloadStartRequest != null ||
params.onDownloadStarting != null) &&
settings.useOnDownloadStart == null) {
settings.useOnDownloadStart = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,20 @@ class MacOSInAppWebViewController extends PlatformInAppWebViewController
break;
case "onDownloadStarting":
if ((webviewParams != null &&
(webviewParams!.onDownloadStart != null ||
webviewParams!.onDownloadStartRequest != null ||
webviewParams!.onDownloadStarting != null)) ||
(webviewParams!.onDownloadStart != null ||
webviewParams!.onDownloadStartRequest != null ||
webviewParams!.onDownloadStarting != null)) ||
_inAppBrowserEventHandler != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
call.arguments.cast<String, dynamic>();
DownloadStartRequest downloadStartRequest =
DownloadStartRequest.fromMap(arguments)!;
DownloadStartRequest.fromMap(arguments)!;

if (webviewParams != null) {
if (webviewParams!.onDownloadStarting != null)
return (await webviewParams!.onDownloadStarting!(
_controllerFromPlatform, downloadStartRequest))?.toMap();
_controllerFromPlatform, downloadStartRequest))
?.toMap();
else if (webviewParams!.onDownloadStartRequest != null)
webviewParams!.onDownloadStartRequest!(
_controllerFromPlatform, downloadStartRequest);
Expand All @@ -375,7 +376,8 @@ class MacOSInAppWebViewController extends PlatformInAppWebViewController
_inAppBrowserEventHandler!
.onDownloadStartRequest(downloadStartRequest);
return (await _inAppBrowserEventHandler!
.onDownloadStarting(downloadStartRequest))?.toMap();
.onDownloadStarting(downloadStartRequest))
?.toMap();
}
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ TrustedWebActivityDisplayMode? _deserializeDisplayMode(
}
switch (displayMode["type"]) {
case "IMMERSIVE_MODE":
return TrustedWebActivityImmersiveDisplayMode.fromMap(displayMode, enumMethod: enumMethod);
return TrustedWebActivityImmersiveDisplayMode.fromMap(displayMode,
enumMethod: enumMethod);
case "DEFAULT_MODE":
default:
return TrustedWebActivityDefaultDisplayMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ class ContentBlockerTrigger {
ContentBlockerTriggerResourceType.fromNativeValue(typeValue),
EnumMethod.value =>
ContentBlockerTriggerResourceType.fromValue(typeValue),
EnumMethod.name =>
ContentBlockerTriggerResourceType.byName(typeValue),
EnumMethod.name => ContentBlockerTriggerResourceType.byName(typeValue),
};
if (type != null) {
resourceType.add(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ class ContextMenu_ {
// ignore: unused_element
Map<String, dynamic> _toMapMergeWith({EnumMethod? enumMethod}) {
return {
"settings": (settings as ContextMenuSettings?)?.toMap(enumMethod: enumMethod) ??
(options as ContextMenuOptions?)?.toMap(enumMethod: enumMethod)
"settings":
(settings as ContextMenuSettings?)?.toMap(enumMethod: enumMethod) ??
(options as ContextMenuOptions?)?.toMap(enumMethod: enumMethod)
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ dynamic _serializeIcon(dynamic icon, {EnumMethod? enumMethod}) {
return icon is Uint8List ? icon : icon?.toMap(enumMethod: enumMethod);
}

dynamic _deserializeIcon(dynamic icon,
{EnumMethod? enumMethod}) {
dynamic _deserializeIcon(dynamic icon, {EnumMethod? enumMethod}) {
if (icon is Uint8List) {
return icon;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ class InAppBrowserClassSettings {
instance = InAppBrowserClassSettings();
}
instance.browserSettings =
InAppBrowserSettings.fromMap(options, enumMethod: enumMethod) ?? InAppBrowserSettings();
InAppBrowserSettings.fromMap(options, enumMethod: enumMethod) ??
InAppBrowserSettings();
instance.webViewSettings =
InAppWebViewSettings.fromMap(options, enumMethod: enumMethod) ?? InAppWebViewSettings();
InAppWebViewSettings.fromMap(options, enumMethod: enumMethod) ??
InAppWebViewSettings();
return instance;
}

Expand Down
Loading

0 comments on commit f5a42f2

Please sign in to comment.