WebView class

A web view widget for showing html content.

There is a known issue that on iOS 13.4 and 13.5, other flutter widgets covering the WebView is not able to block the WebView from receiving touch events. See https://github.com/flutter/flutter/issues/53490.

Inheritance

Constructors

WebView({Key? key, WebViewCreatedCallback? onWebViewCreated, String? initialUrl, JavascriptMode javascriptMode = JavascriptMode.disabled, Set<JavascriptChannel>? javascriptChannels, NavigationDelegate? navigationDelegate, Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers, PageStartedCallback? onPageStarted, PageFinishedCallback? onPageFinished, PageLoadingCallback? onProgress, WebResourceErrorCallback? onWebResourceError, bool debuggingEnabled = false, bool gestureNavigationEnabled = false, String? userAgent, AutoMediaPlaybackPolicy initialMediaPlaybackPolicy = AutoMediaPlaybackPolicy.require_user_action_for_all_media_types, bool allowsInlineMediaPlayback = false})
Creates a new web view.
const

Properties

allowsInlineMediaPlayback bool
Controls whether inline playback of HTML5 videos is allowed on iOS.
final
debuggingEnabled bool
Controls whether WebView debugging is enabled.
final
gestureNavigationEnabled bool
A Boolean value indicating whether horizontal swipe gestures will trigger back-forward list navigations.
final
gestureRecognizers Set<Factory<OneSequenceGestureRecognizer>>?
Which gestures should be consumed by the web view.
final
hashCode int
The hash code for this object.
no setterinherited
initialMediaPlaybackPolicy AutoMediaPlaybackPolicy
Which restrictions apply on automatic media playback.
final
initialUrl String?
The initial URL to load.
final
javascriptChannels Set<JavascriptChannel>?
The set of JavascriptChannels available to JavaScript code running in the web view.
final
javascriptMode JavascriptMode
Whether Javascript execution is enabled.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
A delegate function that decides how to handle navigation actions.
final
onPageFinished PageFinishedCallback?
Invoked when a page has finished loading.
final
onPageStarted PageStartedCallback?
Invoked when a page starts loading.
final
onProgress PageLoadingCallback?
Invoked when a page is loading.
final
onWebResourceError WebResourceErrorCallback?
Invoked when a web resource has failed to load.
final
onWebViewCreated WebViewCreatedCallback?
If not null invoked once the web view is created.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userAgent String?
The value used for the HTTP User-Agent: request header.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

platform WebViewPlatform
The WebView platform that's used by this WebView.
getter/setter pair