mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 08:17:04 +05:30
android: ensure system bar color blending applies to comments screen as well
This commit is contained in:
parent
2b638fcc29
commit
072f939791
1 changed files with 14 additions and 6 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue