Package 

Class WebViewKt

    • Method Detail

      • WebView

        @Composable() final static Unit WebView(WebViewState state, Modifier modifier, Boolean captureBackPresses, WebViewNavigator navigator, Function1<WebView, Unit> onCreated, Function1<WebView, Unit> onDispose, AccompanistWebViewClient client, AccompanistWebChromeClient chromeClient, Function1<Context, WebView> factory)

        A wrapper around the Android View WebView to provide a basic WebView composable.

        If you require more customisation you are most likely better rolling your own and using this wrapper as an example.

        The WebView attempts to set the layoutParams based on the Compose modifier passed in. If it is incorrectly sizing, use the layoutParams composable function instead.

        Parameters:
        state - The webview state holder where the Uri to load is defined.
        modifier - A compose modifier
        captureBackPresses - Set to true to have this Composable capture back presses and navigate the WebView back.
        navigator - An optional navigator object that can be used to control the WebView's navigation from outside the composable.
        onCreated - Called when the WebView is first created, this can be used to set additional settings on the WebView.
        onDispose - Called when the WebView is destroyed.
        client - Provides access to WebViewClient via subclassing
        chromeClient - Provides access to WebChromeClient via subclassing
        factory - An optional WebView factory for using a custom subclass of WebView
      • WebView

        @Composable() final static Unit WebView(WebViewState state, FrameLayout.LayoutParams layoutParams, Modifier modifier, Boolean captureBackPresses, WebViewNavigator navigator, Function1<WebView, Unit> onCreated, Function1<WebView, Unit> onDispose, AccompanistWebViewClient client, AccompanistWebChromeClient chromeClient, Function1<Context, WebView> factory)

        A wrapper around the Android View WebView to provide a basic WebView composable.

        If you require more customisation you are most likely better rolling your own and using this wrapper as an example.

        The WebView attempts to set the layoutParams based on the Compose modifier passed in. If it is incorrectly sizing, use the layoutParams composable function instead.

        Parameters:
        state - The webview state holder where the Uri to load is defined.
        layoutParams - A FrameLayout.LayoutParams object to custom size the underlying WebView.
        modifier - A compose modifier
        captureBackPresses - Set to true to have this Composable capture back presses and navigate the WebView back.
        navigator - An optional navigator object that can be used to control the WebView's navigation from outside the composable.
        onCreated - Called when the WebView is first created, this can be used to set additional settings on the WebView.
        onDispose - Called when the WebView is destroyed.
        client - Provides access to WebViewClient via subclassing
        chromeClient - Provides access to WebChromeClient via subclassing
        factory - An optional WebView factory for using a custom subclass of WebView
      • rememberWebViewState

        @Composable() final static WebViewState rememberWebViewState(String url, Map<String, String> additionalHttpHeaders)

        Creates a WebView state that is remembered across Compositions.

        Parameters:
        url - The url to load in the WebView
        additionalHttpHeaders - Optional, additional HTTP headers that are passed to WebView.loadUrl.
      • rememberSaveableWebViewState

        @Composable() final static WebViewState rememberSaveableWebViewState()

        Creates a WebView state that is remembered across Compositions and saved across activity recreation. When using saved state, you cannot change the URL via recomposition. The only way to load a URL is via a WebViewNavigator.