updated example

This commit is contained in:
Lorenzo Pichilli 2022-04-20 19:20:31 +02:00
parent 9dd5a28541
commit bca59d3e87
4 changed files with 20 additions and 22 deletions

View File

@ -64,17 +64,15 @@ class _ChromeSafariBrowserExampleScreenState
onPressed: () async {
await widget.browser.open(
url: Uri.parse("https://flutter.dev/"),
options: ChromeSafariBrowserClassOptions(
android: AndroidChromeCustomTabsOptions(
shareState: CustomTabsShareState.SHARE_STATE_OFF,
isSingleInstance: false,
isTrustedWebActivity: false,
keepAliveEnabled: true),
ios: IOSSafariOptions(
dismissButtonStyle:
IOSSafariDismissButtonStyle.CLOSE,
presentationStyle:
IOSUIModalPresentationStyle.OVER_FULL_SCREEN)));
settings: ChromeSafariBrowserSettings(
shareState: CustomTabsShareState.SHARE_STATE_OFF,
isSingleInstance: false,
isTrustedWebActivity: false,
keepAliveEnabled: true,
dismissButtonStyle: DismissButtonStyle.CLOSE,
presentationStyle:
ModalPresentationStyle.OVER_FULL_SCREEN
));
},
child: Text("Open Chrome Safari Browser")),
));

View File

@ -91,7 +91,7 @@ class _InAppBrowserExampleScreenState extends State<InAppBrowserExampleScreen> {
super.initState();
pullToRefreshController = PullToRefreshController(
options: PullToRefreshOptions(
settings: PullToRefreshSettings(
color: Colors.black,
),
onRefresh: () async {

View File

@ -70,7 +70,7 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
});
pullToRefreshController = PullToRefreshController(
options: PullToRefreshOptions(
settings: PullToRefreshSettings(
color: Colors.blue,
),
onRefresh: () async {
@ -132,7 +132,7 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
urlController.text = this.url;
});
},
androidOnPermissionRequest: (controller, origin, resources) async {
onPermissionRequest: (controller, origin, resources) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT);

View File

@ -20,18 +20,18 @@ Future main() async {
// await Permission.storage.request();
if (Platform.isAndroid) {
await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true);
await InAppWebViewController.setWebContentsDebuggingEnabled(true);
var swAvailable = await AndroidWebViewFeature.isFeatureSupported(
AndroidWebViewFeature.SERVICE_WORKER_BASIC_USAGE);
var swInterceptAvailable = await AndroidWebViewFeature.isFeatureSupported(
AndroidWebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
var swAvailable = await WebViewFeature.isFeatureSupported(
WebViewFeature.SERVICE_WORKER_BASIC_USAGE);
var swInterceptAvailable = await WebViewFeature.isFeatureSupported(
WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
if (swAvailable && swInterceptAvailable) {
AndroidServiceWorkerController serviceWorkerController =
AndroidServiceWorkerController.instance();
ServiceWorkerController serviceWorkerController =
ServiceWorkerController.instance();
serviceWorkerController.serviceWorkerClient = AndroidServiceWorkerClient(
serviceWorkerController.serviceWorkerClient = ServiceWorkerClient(
shouldInterceptRequest: (request) async {
print(request);
return null;