Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## NEXT

* Adds `WebKitWebViewController.isBlockedByScreenTime` to detect if Screen Time is blocking the webview (iOS 26.0+).

## 3.23.4

* Replaces use of deprecated Color.value.
Expand Down
23 changes: 23 additions & 0 deletions packages/webview_flutter/webview_flutter_wkwebview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ so you do not need to add it to your `pubspec.yaml`.
However, if you `import` this package to use any of its APIs directly, you
should add it to your `pubspec.yaml` as usual.

### iOS-specific Features

The `WebKitWebViewController` provides iOS-specific features beyond the standard webview functionality:

#### Screen Time Detection

On iOS 26.0+, you can detect if the webview is blocked by Screen Time restrictions:

```dart
import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';

// Check if webview is blocked by Screen Time
if (controller is WebKitWebViewController) {
final isBlocked = await controller.isBlockedByScreenTime;
if (isBlocked) {
// Handle Screen Time blocking, e.g., show user-friendly message
print('Content is blocked by Screen Time restrictions');
}
}
```

This property returns `false` on iOS versions earlier than 26.0.

### External Native API

The plugin also provides a native API accessible by the native code of iOS applications or packages.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,17 @@ class WebViewProxyAPIDelegate: PigeonApiDelegateWKWebView, PigeonApiDelegateUIVi
try setAllowsLinkPreview(
pigeonApi: getUIViewWKWebViewAPI(pigeonApi), pigeonInstance: pigeonInstance, allow: allow)
}

func getIsBlockedByScreenTime(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView)
throws -> Bool
{
if #available(iOS 26.0, *) {
return pigeonInstance.isBlockedByScreenTime
} else {
throw (pigeonApi.pigeonRegistrar as! ProxyAPIRegistrar)
.createUnsupportedVersionError(
method: "WKWebView.isBlockedByScreenTime",
versionRequirements: "iOS 26.0")
}
}
}
Loading