NavigationDelegate.fromPlatform constructor
NavigationDelegate.fromPlatform(
- PlatformNavigationDelegate platform, {
- PageEventCallback? onPageStarted,
- PageEventCallback? onPageFinished,
- ProgressCallback? onProgress,
- WebResourceErrorCallback? onWebResourceError,
- void onUrlChange(
- UrlChange change
- HttpAuthRequestCallback? onHttpAuthRequest,
- void onHttpError(
- HttpResponseError error
Constructs a NavigationDelegate from a specific platform implementation.
onUrlChange
: invoked when the underlying web view changes to a new url.
onHttpAuthRequest
: invoked when the web view is requesting authentication.
Implementation
NavigationDelegate.fromPlatform(
this.platform, {
this.onNavigationRequest,
this.onPageStarted,
this.onPageFinished,
this.onProgress,
this.onWebResourceError,
void Function(UrlChange change)? onUrlChange,
HttpAuthRequestCallback? onHttpAuthRequest,
void Function(HttpResponseError error)? onHttpError,
}) {
if (onNavigationRequest != null) {
platform.setOnNavigationRequest(onNavigationRequest!);
}
if (onPageStarted != null) {
platform.setOnPageStarted(onPageStarted!);
}
if (onPageFinished != null) {
platform.setOnPageFinished(onPageFinished!);
}
if (onProgress != null) {
platform.setOnProgress(onProgress!);
}
if (onWebResourceError != null) {
platform.setOnWebResourceError(onWebResourceError!);
}
if (onUrlChange != null) {
platform.setOnUrlChange(onUrlChange);
}
if (onHttpAuthRequest != null) {
platform.setOnHttpAuthRequest(onHttpAuthRequest);
}
if (onHttpError != null) {
platform.setOnHttpError(onHttpError);
}
}