WebViewElement constructor

WebViewElement(
  1. int targetId,
  2. Pointer<NativeElement> nativePtr,
  3. ElementManager elementManager, {
  4. required String tagName,
  5. String? initialUrl,
  6. JavascriptMode javascriptMode = JavascriptMode.unrestricted,
  7. Set<JavascriptChannel>? javascriptChannels,
  8. NavigationDelegate? navigationDelegate,
  9. Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers,
  10. bool debuggingEnabled = false,
  11. bool gestureNavigationEnabled = false,
  12. String userAgent = DEFAULT_USER_AGENT,
  13. AutoMediaPlaybackPolicy initialMediaPlaybackPolicy = AutoMediaPlaybackPolicy.require_user_action_for_all_media_types,
})

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

WebViewElement(
  int targetId,
  Pointer<NativeElement> nativePtr,
  ElementManager elementManager, {
  required String tagName,
  this.initialUrl,
  this.javascriptMode = JavascriptMode.unrestricted,
  this.javascriptChannels,
  this.navigationDelegate,
  this.gestureRecognizers,
  this.debuggingEnabled = false,
  this.gestureNavigationEnabled = false,
  this.userAgent = DEFAULT_USER_AGENT,
  this.initialMediaPlaybackPolicy = AutoMediaPlaybackPolicy.require_user_action_for_all_media_types,
})  : assert(javascriptMode != null),
      assert(initialMediaPlaybackPolicy != null),
      super(targetId, nativePtr, elementManager,
          tagName: tagName, defaultStyle: _defaultStyle, isIntrinsicBox: true, repaintSelf: true) {
  _width = CSSLength.toDisplayPortValue(ELEMENT_DEFAULT_WIDTH, viewportSize: viewportSize);
  _height = CSSLength.toDisplayPortValue(ELEMENT_DEFAULT_HEIGHT, viewportSize: viewportSize);
}