All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.sample.HtmlWebViewSample.kt Maven / Gradle / Ivy

There is a newer version: 1.9.40-alpha04
Show newest version
package sample

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.heightIn
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import web.WebView
import web.rememberWebViewStateWithHTMLData

/**
 * Created By Kevin Zou On 2023/9/8
 */
@Composable
internal fun BasicWebViewWithHTMLSample() {
    val html = """
        
        
            Compose WebView Multiplatform
            
        
        
            

Compose WebView Multiplatform

""".trimIndent() val webViewState = rememberWebViewStateWithHTMLData( data = html ) MaterialTheme { Box(Modifier.fillMaxSize()) { WebView( state = webViewState, modifier = Modifier.matchParentSize() .heightIn(min = 1.dp), // A bottom sheet can't support content with 0 height. captureBackPresses = false, ) } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy