flutter format

This commit is contained in:
Lorenzo Pichilli 2022-10-19 16:54:54 +02:00
parent 065da37d0d
commit 786a544963
21 changed files with 98 additions and 109 deletions

View File

@ -8,10 +8,8 @@ import '../util.dart';
void customMenuItem() {
final shouldSkip = kIsWeb
? true
: ![
TargetPlatform.android,
TargetPlatform.iOS
].contains(defaultTargetPlatform);
: ![TargetPlatform.android, TargetPlatform.iOS]
.contains(defaultTargetPlatform);
test('add custom menu item', () async {
var chromeSafariBrowser = MyChromeSafariBrowser();

View File

@ -8,10 +8,8 @@ import '../util.dart';
void openAndClose() {
final shouldSkip = kIsWeb
? true
: ![
TargetPlatform.android,
TargetPlatform.iOS
].contains(defaultTargetPlatform);
: ![TargetPlatform.android, TargetPlatform.iOS]
.contains(defaultTargetPlatform);
test('open and close', () async {
var chromeSafariBrowser = MyChromeSafariBrowser();

View File

@ -22,4 +22,4 @@
library flutter_inappwebview;
export 'src/main.dart';
export 'src/web/main_stub.dart' if (dart.library.html) 'src/web/main.dart';
export 'src/web/main_stub.dart' if (dart.library.html) 'src/web/main.dart';

View File

@ -59,8 +59,10 @@ class InAppBrowserClassSettings {
if (instance == null) {
instance = InAppBrowserClassSettings();
}
instance.browserSettings = InAppBrowserSettings.fromMap(options) ?? InAppBrowserSettings();
instance.webViewSettings = InAppWebViewSettings.fromMap(options) ?? InAppWebViewSettings();
instance.browserSettings =
InAppBrowserSettings.fromMap(options) ?? InAppBrowserSettings();
instance.webViewSettings =
InAppWebViewSettings.fromMap(options) ?? InAppWebViewSettings();
return instance;
}

View File

@ -688,7 +688,9 @@ class _InAppWebViewState extends State<InAppWebView> {
creationParamsCodec: const StandardMessageCodec(),
);
}
} else if (defaultTargetPlatform == TargetPlatform.iOS/* || defaultTargetPlatform == TargetPlatform.macOS*/) {
} else if (defaultTargetPlatform ==
TargetPlatform
.iOS /* || defaultTargetPlatform == TargetPlatform.macOS*/) {
return UiKitView(
viewType: 'com.pichillilorenzo/flutter_inappwebview',
onPlatformViewCreated: _onPlatformViewCreated,

View File

@ -113,7 +113,7 @@ class InAppWebViewController {
_debugLog(String method, dynamic args) {
debugLog(
className: this.runtimeType.toString(),
name: _inAppBrowser == null ? "WebView" : "InAppBrowser",
name: _inAppBrowser == null ? "WebView" : "InAppBrowser",
id: (getViewId() ?? _inAppBrowser?.id).toString(),
debugLoggingSettings: WebView.debugLoggingSettings,
method: method,

View File

@ -33,7 +33,8 @@ import '../context_menu.dart';
part 'in_app_webview_settings.g.dart';
List<ContentBlocker> _deserializeContentBlockers(List<dynamic>? contentBlockersMapList) {
List<ContentBlocker> _deserializeContentBlockers(
List<dynamic>? contentBlockersMapList) {
List<ContentBlocker> contentBlockers = [];
if (contentBlockersMapList != null) {
contentBlockersMapList.forEach((contentBlocker) {

View File

@ -214,4 +214,4 @@ export 'print_job_disposition.dart' show PrintJobDisposition;
export 'printer.dart' show Printer;
export 'window_type.dart' show WindowType;
export 'window_style_mask.dart' show WindowStyleMask;
export 'window_titlebar_separator_style.dart' show WindowTitlebarSeparatorStyle;
export 'window_titlebar_separator_style.dart' show WindowTitlebarSeparatorStyle;

View File

@ -29,7 +29,7 @@ class PermissionResourceType_ {
available: "12.0",
apiName: 'WKMediaCaptureType.microphone',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone',
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone',
value: 1)
])
static const MICROPHONE = PermissionResourceType_._internal('MICROPHONE');
@ -74,7 +74,7 @@ class PermissionResourceType_ {
available: "12.0",
apiName: 'WKMediaCaptureType.camera',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera',
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera',
value: 0)
])
static const CAMERA = PermissionResourceType_._internal('CAMERA');
@ -91,7 +91,7 @@ class PermissionResourceType_ {
available: "12.0",
apiName: 'WKMediaCaptureType.cameraAndMicrophone',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone',
'https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone',
value: 2)
])
static const CAMERA_AND_MICROPHONE =

View File

@ -23,8 +23,11 @@ class PrintJobAttributes_ {
PrintJobColorMode_? colorMode;
///The duplex mode to use for the print job.
@SupportedPlatforms(
platforms: [AndroidPlatform(available: "23"), IOSPlatform(), MacOSPlatform()])
@SupportedPlatforms(platforms: [
AndroidPlatform(available: "23"),
IOSPlatform(),
MacOSPlatform()
])
PrintJobDuplexMode_? duplex;
///The orientation of the printed content, portrait or landscape.

View File

@ -15,12 +15,16 @@ class PrintJobColorMode_ {
const PrintJobColorMode_._internal(this._value);
///Monochrome color scheme, for example one color is used.
@EnumSupportedPlatforms(
platforms: [EnumAndroidPlatform(value: 1), EnumMacOSPlatform(value: "Gray")])
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(value: 1),
EnumMacOSPlatform(value: "Gray")
])
static const MONOCHROME = const PrintJobColorMode_._internal(1);
///Color color scheme, for example many colors are used.
@EnumSupportedPlatforms(
platforms: [EnumAndroidPlatform(value: 1), EnumMacOSPlatform(value: "RGB")])
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(value: 1),
EnumMacOSPlatform(value: "RGB")
])
static const COLOR = const PrintJobColorMode_._internal(2);
}

View File

@ -13,26 +13,18 @@ class PrintJobDisposition_ {
const PrintJobDisposition_._internal(this._value);
///Normal print job.
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 'spool')
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 'spool')])
static const SPOOL = const PrintJobDisposition_._internal('SPOOL');
///Send to Preview application.
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 'preview')
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 'preview')])
static const PREVIEW = const PrintJobDisposition_._internal("PREVIEW");
///Save to a file.
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 'save')
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 'save')])
static const SAVE = const PrintJobDisposition_._internal("SAVE");
///Cancel print job.
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 'cancel')
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 'cancel')])
static const CANCEL = const PrintJobDisposition_._internal("CANCEL");
}

View File

@ -16,19 +16,28 @@ class PrintJobDuplexMode_ {
const PrintJobDuplexMode_._internal(this._value);
///No double-sided (duplex) printing; single-sided printing only.
@EnumSupportedPlatforms(
platforms: [EnumAndroidPlatform(value: 1), EnumIOSPlatform(value: 0), EnumMacOSPlatform(value: 1)])
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(value: 1),
EnumIOSPlatform(value: 0),
EnumMacOSPlatform(value: 1)
])
static const NONE = PrintJobDuplexMode_._internal('NONE');
///Duplex printing that flips the back page along the long edge of the paper.
///Pages are turned sideways along the long edge - like a book.
@EnumSupportedPlatforms(
platforms: [EnumAndroidPlatform(value: 2), EnumIOSPlatform(value: 1), EnumMacOSPlatform(value: 2)])
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(value: 2),
EnumIOSPlatform(value: 1),
EnumMacOSPlatform(value: 2)
])
static const LONG_EDGE = PrintJobDuplexMode_._internal('LONG_EDGE');
///Duplex print that flips the back page along the short edge of the paper.
///Pages are turned upwards along the short edge - like a notepad.
@EnumSupportedPlatforms(
platforms: [EnumAndroidPlatform(value: 4), EnumIOSPlatform(value: 2), EnumMacOSPlatform(value: 3)])
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(value: 4),
EnumIOSPlatform(value: 2),
EnumMacOSPlatform(value: 3)
])
static const SHORT_EDGE = PrintJobDuplexMode_._internal('SHORT_EDGE');
}

View File

@ -139,7 +139,7 @@ class PrintJobInfo_ {
this.canSpawnSeparateThread,
this.isCopyingOperation,
this.currentPage,
this.firstPage,
this.lastPage,
this.firstPage,
this.lastPage,
this.attributes});
}

View File

@ -13,16 +13,12 @@ class PrintJobOrientation_ {
const PrintJobOrientation_._internal(this._value);
///Pages are printed in portrait orientation.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(value: 0),
EnumMacOSPlatform(value: 0)
])
@EnumSupportedPlatforms(
platforms: [EnumIOSPlatform(value: 0), EnumMacOSPlatform(value: 0)])
static const PORTRAIT = const PrintJobOrientation_._internal(0);
///Pages are printed in landscape orientation.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(value: 1),
EnumMacOSPlatform(value: 1)
])
@EnumSupportedPlatforms(
platforms: [EnumIOSPlatform(value: 1), EnumMacOSPlatform(value: 1)])
static const LANDSCAPE = const PrintJobOrientation_._internal(1);
}

View File

@ -13,26 +13,18 @@ class PrintJobPageOrder_ {
const PrintJobPageOrder_._internal(this._value);
///Descending (front to back) page order.
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: -1)
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: -1)])
static const DESCENDING = const PrintJobPageOrder_._internal(-1);
///The spooler does not rearrange pagesthey are printed in the order received by the spooler.
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 0)
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 0)])
static const SPECIAL = const PrintJobPageOrder_._internal(0);
///Ascending (back to front) page order.
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 1)
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 1)])
static const ASCENDING = const PrintJobPageOrder_._internal(1);
///No page order specified.
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 2)
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 2)])
static const UNKNOWN = const PrintJobPageOrder_._internal(2);
}

View File

@ -15,20 +15,14 @@ class PrintJobPaginationMode_ {
const PrintJobPaginationMode_._internal(this._value);
///
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 0)
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 0)])
static const AUTOMATIC = const PrintJobPaginationMode_._internal('AUTOMATIC');
///
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 1)
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 1)])
static const FIT = const PrintJobPaginationMode_._internal("FIT");
///
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(value: 2)
])
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 2)])
static const CLIP = const PrintJobPaginationMode_._internal("CLIP");
}

View File

@ -13,17 +13,13 @@ class PrintJobRenderingQuality_ {
const PrintJobRenderingQuality_._internal(this._value);
///Renders the printing at the best possible quality, regardless of speed.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(value: 0),
EnumMacOSPlatform(value: 0)
])
@EnumSupportedPlatforms(
platforms: [EnumIOSPlatform(value: 0), EnumMacOSPlatform(value: 0)])
static const BEST = const PrintJobRenderingQuality_._internal(0);
///Sacrifices the least possible amount of rendering quality for speed to maintain a responsive user interface.
///This option should be used only after establishing that best quality rendering does indeed make the user interface unresponsive.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(value: 1),
EnumMacOSPlatform(value: 1)
])
@EnumSupportedPlatforms(
platforms: [EnumIOSPlatform(value: 1), EnumMacOSPlatform(value: 1)])
static const RESPONSIVE = const PrintJobRenderingQuality_._internal(1);
}

View File

@ -15,10 +15,10 @@ class WindowStyleMask_ {
///The window displays none of the usual peripheral elements. Useful only for display or caching purposes.
@EnumSupportedPlatforms(platforms: [
EnumMacOSPlatform(
value: 0,
apiName: "NSWindow.StyleMask.borderless",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644698-borderless"
)
value: 0,
apiName: "NSWindow.StyleMask.borderless",
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644698-borderless")
])
static const BORDERLESS = const WindowStyleMask_._internal(0);
@ -27,8 +27,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 1,
apiName: "NSWindow.StyleMask.titled",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644724-titled"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644724-titled")
])
static const TITLED = const WindowStyleMask_._internal(1);
@ -37,8 +37,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 2,
apiName: "NSWindow.StyleMask.closable",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644610-closable"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644610-closable")
])
static const CLOSABLE = const WindowStyleMask_._internal(2);
@ -47,8 +47,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 4,
apiName: "NSWindow.StyleMask.miniaturizable",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644650-miniaturizable"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644650-miniaturizable")
])
static const MINIATURIZABLE = const WindowStyleMask_._internal(4);
@ -57,8 +57,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 8,
apiName: "NSWindow.StyleMask.miniaturizable",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644717-resizable"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644717-resizable")
])
static const RESIZABLE = const WindowStyleMask_._internal(8);
@ -67,8 +67,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 16384,
apiName: "NSWindow.StyleMask.fullScreen",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644530-fullscreen"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644530-fullscreen")
])
static const FULLSCREEN = const WindowStyleMask_._internal(16384);
@ -79,8 +79,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 32768,
apiName: "NSWindow.StyleMask.fullSizeContentView",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644646-fullsizecontentview"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644646-fullsizecontentview")
])
static const FULL_SIZE_CONTENT_VIEW = const WindowStyleMask_._internal(32768);
@ -89,8 +89,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 16,
apiName: "NSWindow.StyleMask.utilityWindow",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644672-utilitywindow"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644672-utilitywindow")
])
static const UTILITY_WINDOW = const WindowStyleMask_._internal(16);
@ -99,8 +99,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 64,
apiName: "NSWindow.StyleMask.docModalWindow",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644253-docmodalwindow"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644253-docmodalwindow")
])
static const DOC_MODAL_WINDOW = const WindowStyleMask_._internal(64);
@ -109,8 +109,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 128,
apiName: "NSWindow.StyleMask.nonactivatingPanel",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644696-nonactivatingpanel"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644696-nonactivatingpanel")
])
static const NONACTIVATING_PANEL = const WindowStyleMask_._internal(128);
@ -119,8 +119,8 @@ class WindowStyleMask_ {
EnumMacOSPlatform(
value: 8192,
apiName: "NSWindow.StyleMask.hudWindow",
apiUrl: "https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644653-hudwindow"
)
apiUrl:
"https://developer.apple.com/documentation/appkit/nswindow/stylemask/1644653-hudwindow")
])
static const HUD_WINDOW = const WindowStyleMask_._internal(8192);
}
}

View File

@ -27,4 +27,4 @@ class WindowTitlebarSeparatorStyle_ {
///A style indicating that the title bar separator is a shadow.
@EnumSupportedPlatforms(platforms: [EnumMacOSPlatform(value: 3)])
static const SHADOW = const WindowTitlebarSeparatorStyle_._internal(3);
}
}

View File

@ -97,7 +97,8 @@ class InAppWebViewWebElement implements Disposable {
return await getSettings();
case "setSettings":
InAppWebViewSettings newSettings = InAppWebViewSettings.fromMap(
call.arguments["settings"].cast<String, dynamic>()) ?? InAppWebViewSettings();
call.arguments["settings"].cast<String, dynamic>()) ??
InAppWebViewSettings();
await setSettings(newSettings);
break;
case "getUrl":
@ -403,7 +404,8 @@ class InAppWebViewWebElement implements Disposable {
Future<void> setSettings(InAppWebViewSettings newSettings) async {
Set<Sandbox> sandbox = getSandbox();
if (newSettings.javaScriptEnabled != null && settings.javaScriptEnabled != newSettings.javaScriptEnabled) {
if (newSettings.javaScriptEnabled != null &&
settings.javaScriptEnabled != newSettings.javaScriptEnabled) {
if (!newSettings.javaScriptEnabled!) {
sandbox.remove(Sandbox.ALLOW_SCRIPTS);
} else {