WebView constructor

const WebView({
  1. Key? key,
  2. WebViewCreatedCallback? onWebViewCreated,
  3. String? initialUrl,
  4. List<WebViewCookie> initialCookies = const <WebViewCookie>[],
  5. JavascriptMode javascriptMode = JavascriptMode.disabled,
  6. Set<JavascriptChannel>? javascriptChannels,
  7. NavigationDelegate? navigationDelegate,
  8. Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers,
  9. PageStartedCallback? onPageStarted,
  10. PageFinishedCallback? onPageFinished,
  11. PageLoadingCallback? onProgress,
  12. WebResourceErrorCallback? onWebResourceError,
  13. bool debuggingEnabled = false,
  14. bool gestureNavigationEnabled = false,
  15. bool geolocationEnabled = false,
  16. String? userAgent,
  17. bool zoomEnabled = true,
  18. AutoMediaPlaybackPolicy initialMediaPlaybackPolicy = AutoMediaPlaybackPolicy.require_user_action_for_all_media_types,
  19. bool allowsInlineMediaPlayback = false,
  20. Color? backgroundColor,
})

Creates a new web view.

The web view can be controlled using a WebViewController that is passed to the onWebViewCreated callback once the web view is created.

The javascriptMode and autoMediaPlaybackPolicy parameters must not be null.

Implementation

const WebView({
  Key? key,
  this.onWebViewCreated,
  this.initialUrl,
  this.initialCookies = const <WebViewCookie>[],
  this.javascriptMode = JavascriptMode.disabled,
  this.javascriptChannels,
  this.navigationDelegate,
  this.gestureRecognizers,
  this.onPageStarted,
  this.onPageFinished,
  this.onProgress,
  this.onWebResourceError,
  this.debuggingEnabled = false,
  this.gestureNavigationEnabled = false,
  this.geolocationEnabled = false,
  this.userAgent,
  this.zoomEnabled = true,
  this.initialMediaPlaybackPolicy =
      AutoMediaPlaybackPolicy.require_user_action_for_all_media_types,
  this.allowsInlineMediaPlayback = false,
  this.backgroundColor,
})  : assert(javascriptMode != null),
      assert(initialMediaPlaybackPolicy != null),
      assert(allowsInlineMediaPlayback != null),
      super(key: key);