code formatting

This commit is contained in:
Lorenzo Pichilli 2021-03-05 23:32:49 +01:00
parent 5cc257895c
commit 0744743c97
7 changed files with 51 additions and 43 deletions

View File

@ -111,7 +111,11 @@ class InAppBrowser {
args.putIfAbsent('windowId', () => windowId); args.putIfAbsent('windowId', () => windowId);
args.putIfAbsent('initialUserScripts', args.putIfAbsent('initialUserScripts',
() => initialUserScripts?.map((e) => e.toMap()).toList() ?? []); () => initialUserScripts?.map((e) => e.toMap()).toList() ?? []);
args.putIfAbsent('pullToRefreshOptions', () => pullToRefreshController?.options.toMap() ?? PullToRefreshOptions(enabled: false).toMap()); args.putIfAbsent(
'pullToRefreshOptions',
() =>
pullToRefreshController?.options.toMap() ??
PullToRefreshOptions(enabled: false).toMap());
await _sharedChannel.invokeMethod('open', args); await _sharedChannel.invokeMethod('open', args);
} }
@ -165,7 +169,11 @@ class InAppBrowser {
args.putIfAbsent('windowId', () => windowId); args.putIfAbsent('windowId', () => windowId);
args.putIfAbsent('initialUserScripts', args.putIfAbsent('initialUserScripts',
() => initialUserScripts?.map((e) => e.toMap()).toList() ?? []); () => initialUserScripts?.map((e) => e.toMap()).toList() ?? []);
args.putIfAbsent('pullToRefreshOptions', () => pullToRefreshController?.options.toMap() ?? PullToRefreshOptions(enabled: false).toMap()); args.putIfAbsent(
'pullToRefreshOptions',
() =>
pullToRefreshController?.options.toMap() ??
PullToRefreshOptions(enabled: false).toMap());
await _sharedChannel.invokeMethod('open', args); await _sharedChannel.invokeMethod('open', args);
} }
@ -201,7 +209,11 @@ class InAppBrowser {
args.putIfAbsent('windowId', () => windowId); args.putIfAbsent('windowId', () => windowId);
args.putIfAbsent('initialUserScripts', args.putIfAbsent('initialUserScripts',
() => initialUserScripts?.map((e) => e.toMap()).toList() ?? []); () => initialUserScripts?.map((e) => e.toMap()).toList() ?? []);
args.putIfAbsent('pullToRefreshOptions', () => pullToRefreshController?.options.toMap() ?? PullToRefreshOptions(enabled: false).toMap()); args.putIfAbsent(
'pullToRefreshOptions',
() =>
pullToRefreshController?.options.toMap() ??
PullToRefreshOptions(enabled: false).toMap());
await _sharedChannel.invokeMethod('open', args); await _sharedChannel.invokeMethod('open', args);
} }

View File

@ -129,7 +129,9 @@ class HeadlessInAppWebView implements WebView {
'windowId': this.windowId, 'windowId': this.windowId,
'initialUserScripts': 'initialUserScripts':
this.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], this.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
'pullToRefreshOptions': this.pullToRefreshController?.options.toMap() ?? PullToRefreshOptions(enabled: false).toMap() 'pullToRefreshOptions':
this.pullToRefreshController?.options.toMap() ??
PullToRefreshOptions(enabled: false).toMap()
}); });
await _sharedChannel.invokeMethod('createHeadlessWebView', args); await _sharedChannel.invokeMethod('createHeadlessWebView', args);
} }

View File

@ -385,7 +385,9 @@ class _InAppWebViewState extends State<InAppWebView> {
'initialUserScripts': 'initialUserScripts':
widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? widget.initialUserScripts?.map((e) => e.toMap()).toList() ??
[], [],
'pullToRefreshOptions': widget.pullToRefreshController?.options.toMap() ?? PullToRefreshOptions(enabled: false).toMap() 'pullToRefreshOptions':
widget.pullToRefreshController?.options.toMap() ??
PullToRefreshOptions(enabled: false).toMap()
}, },
creationParamsCodec: const StandardMessageCodec(), creationParamsCodec: const StandardMessageCodec(),
) )
@ -412,7 +414,9 @@ class _InAppWebViewState extends State<InAppWebView> {
'windowId': widget.windowId, 'windowId': widget.windowId,
'initialUserScripts': 'initialUserScripts':
widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
'pullToRefreshOptions': widget.pullToRefreshController?.options.toMap() ?? PullToRefreshOptions(enabled: false).toMap() 'pullToRefreshOptions':
widget.pullToRefreshController?.options.toMap() ??
PullToRefreshOptions(enabled: false).toMap()
}, },
creationParamsCodec: const StandardMessageCodec(), creationParamsCodec: const StandardMessageCodec(),
); );
@ -433,7 +437,9 @@ class _InAppWebViewState extends State<InAppWebView> {
'windowId': widget.windowId, 'windowId': widget.windowId,
'initialUserScripts': 'initialUserScripts':
widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
'pullToRefreshOptions': widget.pullToRefreshController?.options.toMap() ?? PullToRefreshOptions(enabled: false).toMap() 'pullToRefreshOptions':
widget.pullToRefreshController?.options.toMap() ??
PullToRefreshOptions(enabled: false).toMap()
}, },
creationParamsCodec: const StandardMessageCodec(), creationParamsCodec: const StandardMessageCodec(),
); );

View File

@ -14,4 +14,4 @@ export 'in_app_localhost_server.dart';
export 'content_blocker.dart'; export 'content_blocker.dart';
export 'http_auth_credentials_database.dart'; export 'http_auth_credentials_database.dart';
export 'context_menu.dart'; export 'context_menu.dart';
export 'pull_to_refresh/main.dart'; export 'pull_to_refresh/main.dart';

View File

@ -26,8 +26,7 @@ class PullToRefreshController {
Future<dynamic> handleMethod(MethodCall call) async { Future<dynamic> handleMethod(MethodCall call) async {
switch (call.method) { switch (call.method) {
case "onRefresh": case "onRefresh":
if (onRefresh != null) if (onRefresh != null) onRefresh!();
onRefresh!();
break; break;
default: default:
throw UnimplementedError("Unimplemented ${call.method} method"); throw UnimplementedError("Unimplemented ${call.method} method");
@ -123,8 +122,8 @@ class PullToRefreshController {
} }
void initMethodChannel(dynamic id) { void initMethodChannel(dynamic id) {
this._channel = this._channel = MethodChannel(
MethodChannel('com.pichillilorenzo/flutter_inappwebview_pull_to_refresh_$id'); 'com.pichillilorenzo/flutter_inappwebview_pull_to_refresh_$id');
this._channel?.setMethodCallHandler(handleMethod); this._channel?.setMethodCallHandler(handleMethod);
} }
} }

View File

@ -27,14 +27,13 @@ class PullToRefreshOptions {
///**NOTE**: Available only on iOS. ///**NOTE**: Available only on iOS.
IOSNSAttributedString? attributedTitle; IOSNSAttributedString? attributedTitle;
PullToRefreshOptions({ PullToRefreshOptions(
this.enabled = true, {this.enabled = true,
this.color, this.color,
this.backgroundColor, this.backgroundColor,
this.distanceToTriggerSync, this.distanceToTriggerSync,
this.slingshotDistance, this.slingshotDistance,
this.attributedTitle this.attributedTitle});
});
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
@ -55,4 +54,4 @@ class PullToRefreshOptions {
String toString() { String toString() {
return toMap().toString(); return toMap().toString();
} }
} }

View File

@ -6707,40 +6707,31 @@ class IOSNSUnderlineStyle {
} }
///Do not draw a line. ///Do not draw a line.
static const STYLE_NONE = static const STYLE_NONE = const IOSNSUnderlineStyle._internal(0);
const IOSNSUnderlineStyle._internal(0);
///Draw a single line. ///Draw a single line.
static const SINGLE = static const SINGLE = const IOSNSUnderlineStyle._internal(1);
const IOSNSUnderlineStyle._internal(1);
///Draw a thick line. ///Draw a thick line.
static const THICK = static const THICK = const IOSNSUnderlineStyle._internal(2);
const IOSNSUnderlineStyle._internal(2);
///Draw a double line. ///Draw a double line.
static const DOUBLE = static const DOUBLE = const IOSNSUnderlineStyle._internal(9);
const IOSNSUnderlineStyle._internal(9);
///Draw a line of dots. ///Draw a line of dots.
static const PATTERN_DOT = static const PATTERN_DOT = const IOSNSUnderlineStyle._internal(256);
const IOSNSUnderlineStyle._internal(256);
///Draw a line of dashes. ///Draw a line of dashes.
static const PATTERN_DASH = static const PATTERN_DASH = const IOSNSUnderlineStyle._internal(512);
const IOSNSUnderlineStyle._internal(512);
///Draw a line of alternating dashes and dots. ///Draw a line of alternating dashes and dots.
static const PATTERN_DASH_DOT = static const PATTERN_DASH_DOT = const IOSNSUnderlineStyle._internal(768);
const IOSNSUnderlineStyle._internal(768);
///Draw a line of alternating dashes and two dots. ///Draw a line of alternating dashes and two dots.
static const PATTERN_DASH_DOT_DOT = static const PATTERN_DASH_DOT_DOT = const IOSNSUnderlineStyle._internal(1024);
const IOSNSUnderlineStyle._internal(1024);
///Draw the line only beneath or through words, not whitespace. ///Draw the line only beneath or through words, not whitespace.
static const BY_WORD = static const BY_WORD = const IOSNSUnderlineStyle._internal(32768);
const IOSNSUnderlineStyle._internal(32768);
bool operator ==(value) => value == _value; bool operator ==(value) => value == _value;
@ -6777,11 +6768,10 @@ class IOSNSAttributedStringTextEffectStyle {
///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper. ///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper.
static const LETTERPRESS_STYLE = static const LETTERPRESS_STYLE =
const IOSNSAttributedStringTextEffectStyle._internal( const IOSNSAttributedStringTextEffectStyle._internal("letterpressStyle");
"letterpressStyle");
bool operator ==(value) => value == _value; bool operator ==(value) => value == _value;
@override @override
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }