Webview

WebView widget

The WebView Widget enables seamless integration of web content within native apps and web apps, providing a versatile and consistent browsing experience across platforms. In addition to its core functionality, WebView also supports the use of cookies. Learn more here!

Test in Kitchen Sink (opens in a new tab)

Properties

PropertyTypeDescription
urlstringDefines the web address (URL) to be loaded within the WebView widget.
stylesobjectSee properties
allowedLaunchSchemesarray of stringsOnly available on iOS and Android native apps. Will not have any affect on the web. Optionally specify array of url schemes such as 'tel:', 'mailto:', 'geo:' that when tapped should launch the apps corresponding to the scheme in the system the app is running in.. See below for more details for this property. URL schemes such as http and https are included by default and cannot be overwritten.

allowedLaunchSchemes

Array of strings.

  • tel: opens the phone dialer
  • mailto: opens the email client
  • geo: opens the map application
  • sms: opens the messaging application

When allowedLaunchSchemes is not present, by default the following schemes are permitted. 'tel:', 'sms:', 'mailto:', 'geo:'

You can override the defaults by specifying the allowedLaunchSchemes.

For example - if you are displaying messages inside your webview and want the users to be able to slack someone, you will specify the allowed url schemes as follows -

        - WebView:
            url: https://messages.mycompany.com
            allowedLaunchSchemes:
              - "tel:"
              - "sms:"
              - "mailto:"
              - "slack:"
              
          #note that if you explicitly specify `allowedLaunchSchemes` you must specify the defaults as well if you want them to be allowed otherwise they will be overwritten

In order to add additional schemes to the default schemes, specify the default schemes and the additional schemes as an array value of allowedLaunchSchemes. URL schemes such as http and https are included by default and cannot be overwritten.

Events

EventDescription
onPageStartInvoked when a page has started loading
onPageFinishedInvoked when a page has finished loading.
onProgressInvoked when a page is loading to report the progress.
onNavigationRequestInvoked when a decision for a navigation request is pending. When a navigation is initiated by the WebView (e.g when a user clicks a link) this delegate is called and has to decide how to proceed with the navigation.
onWebResourceErrorInvoked when a resource loading error occurred.

styles

PropertyTypeDescription
expandedbooleanIf the parent is a Row or Column, this flag will stretch this widget in the appropriate direction. (e.g stretch horizontally for parent of type Row)
widthintegerBy default the width will match its parent's available width, but you can set an explicit width here.
heightintegerIf no height is specified, the web view will stretch its height to fit its content, in which case a scrollable parent is required to scroll the content. You may override this behavior by explicitly set the web view's height here, or uses 'expanded' to fill the available height.
stackPositionTopintegerThe distance of the child's top edge from the top of the stack. This is applicable only for Stack's children.
stackPositionBottomintegerThe distance that the child's bottom edge from the bottom of the stack. This is applicable only for Stack's children.
stackPositionLeftintegerThe distance that the child's left edge from the left of the stack. This is applicable only for Stack's children.
stackPositionRightintegerThe distance that the child's right edge from the right of the stack. This is applicable only for Stack's children.
elevationintegerThe z-coordinate at which to place this material relative to its parent. A non-zero value will show a shadow, with its size relative to the elevation value. Minimum value: 0, Maximum value: 24
elevationShadowColorinteger or stringThe shadow color for the elevation, which can be represented in different formats. It can be specified as a number, a predefined color name, or a hexadecimal value starting with '0x'. transparent black blue white red grey teal amber pink purple yellow green brown cyan indigo lime orange
elevationBorderRadiusstring or integerThe border radius of the widget.This can be specified using CSS-like notation with 1 to 4 integers. Minimum value: 0.
alignmentstringThe alignment of the widget relative to its parent. topLeft, topCenter, topRight, centerLeft, center, centerRight, bottomLeft, bottomCenter, bottomRight
captureWebPointerbooleanApplicable for Web only. When overlaying widgets on top of certain HTML container (e.g. Maps), the mouse click is captured by the HTML container, causing issue interacting with the widget. Use this to capture and maintain the mouse pointer on your widget.
visibilityTransitionDurationnumberSpecify the duration in seconds when a widget animates between visible and not visible state. Note that setting this value will cause the widget to still occupy the UI space even when it is not visible.
visiblebooleanToggle a widget visibility on/off. Note that an invisible widget will not occupy UI space, unless the visibilityTransitionDuration is specified.