android: ensure system bar color blending applies to comments screen as well

This commit is contained in:
Harsh Shandilya 2022-02-07 11:37:29 +05:30
parent 2b638fcc29
commit 072f939791
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -5,6 +5,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
@ -12,6 +13,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
@ -69,12 +71,6 @@ fun LobstersApp(
) {
ProvideWindowInsets {
val systemBarsColor = MaterialTheme.colorScheme.surfaceColorAtNavigationBarElevation()
SideEffect {
systemUiController.setStatusBarColor(color = systemBarsColor)
systemUiController.setNavigationBarColor(color = systemBarsColor)
}
val navItems =
listOf(
NavigationItem(
@ -89,6 +85,18 @@ fun LobstersApp(
),
)
SideEffect { systemUiController.setStatusBarColor(color = systemBarsColor) }
LaunchedEffect(currentDestination) {
val color =
if (currentDestination !in navItems.map { it.route }) {
Color.Transparent
} else {
systemBarsColor
}
systemUiController.setNavigationBarColor(color = color)
}
Scaffold(
topBar = {
ClawAppBar(