I have the following screen which should show a loading indicator while the website isn't shown. However the WebView
prevents any other composables from showing up until it is ready to show the website.
How can I show something else on this screen before the website shows up?
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.google.accompanist.web.LoadingState
import com.google.accompanist.web.WebView
import com.google.accompanist.web.rememberWebViewState
@Composable
fun UrlScreen() {
val state = rememberWebViewState(url = "https://stackoverflow.com")
Column {
val loadingState = state.loadingState
if (loadingState is LoadingState.Loading) {
LinearProgressIndicator(
progress = loadingState.progress,
modifier = Modifier.fillMaxWidth()
)
}
Text("This text won't show up before the website shows up.")
WebView(
state = state,
modifier = Modifier.weight(1f),
)
}
}