NavigationDelegate.fromPlatformCreationParams constructor
NavigationDelegate.fromPlatformCreationParams(
- PlatformNavigationDelegateCreationParams params, {
- void onPageStarted(
- String url
- void onPageFinished(
- String url
- void onProgress(
- int progress
- void onWebResourceError(
- WebResourceError error
- void onUrlChange(
- UrlChange change
Constructs a NavigationDelegate from creation params for a specific platform.
onUrlChange
: invoked when the underlying web view changes to a new url.
Below is an example of setting platform-specific creation parameters for iOS and Android:
PlatformNavigationDelegateCreationParams params =
const PlatformNavigationDelegateCreationParams();
if (WebViewPlatform.instance is WebKitWebViewPlatform) {
params = WebKitNavigationDelegateCreationParams
.fromPlatformNavigationDelegateCreationParams(
params,
);
} else if (WebViewPlatform.instance is AndroidWebViewPlatform) {
params = AndroidNavigationDelegateCreationParams
.fromPlatformNavigationDelegateCreationParams(
params,
);
}
final NavigationDelegate navigationDelegate =
NavigationDelegate.fromPlatformCreationParams(
params,
);
Implementation
NavigationDelegate.fromPlatformCreationParams(
PlatformNavigationDelegateCreationParams params, {
FutureOr<NavigationDecision> Function(NavigationRequest request)?
onNavigationRequest,
void Function(String url)? onPageStarted,
void Function(String url)? onPageFinished,
void Function(int progress)? onProgress,
void Function(WebResourceError error)? onWebResourceError,
void Function(UrlChange change)? onUrlChange,
}) : this.fromPlatform(
PlatformNavigationDelegate(params),
onNavigationRequest: onNavigationRequest,
onPageStarted: onPageStarted,
onPageFinished: onPageFinished,
onProgress: onProgress,
onWebResourceError: onWebResourceError,
onUrlChange: onUrlChange,
);