iosWebViewFix/example/integration_test/in_app_webview/pull_to_refresh.dart

46 lines
1.4 KiB
Dart
Raw Normal View History

part of 'main.dart';
2022-04-28 21:23:38 +00:00
void pullToRefresh() {
2022-04-29 11:39:28 +00:00
final shouldSkip = kIsWeb
? true
: ![
TargetPlatform.android,
TargetPlatform.iOS,
TargetPlatform.macOS,
].contains(defaultTargetPlatform);
2022-04-28 21:23:38 +00:00
skippableTestWidgets('launches with pull-to-refresh feature',
2022-04-28 21:23:38 +00:00
(WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>();
2022-04-28 21:23:38 +00:00
final pullToRefreshController = PullToRefreshController(
settings: PullToRefreshSettings(
color: Colors.blue,
size: PullToRefreshSize.DEFAULT,
backgroundColor: Colors.grey,
enabled: true,
slingshotDistance: 150,
distanceToTriggerSync: 150,
attributedTitle: AttributedString(string: "test")),
onRefresh: () {},
);
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: InAppWebView(
key: GlobalKey(),
2022-04-29 11:39:28 +00:00
initialUrlRequest: URLRequest(url: TEST_URL_1),
2022-04-28 21:23:38 +00:00
pullToRefreshController: pullToRefreshController,
onWebViewCreated: (controller) {
controllerCompleter.complete(controller);
},
),
),
);
final InAppWebViewController controller = await controllerCompleter.future;
2022-04-28 21:23:38 +00:00
final String? currentUrl = (await controller.getUrl())?.toString();
expect(currentUrl, TEST_URL_1.toString());
}, skip: shouldSkip);
}