mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 05:17:03 +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.MaterialTheme
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.SideEffect
|
import androidx.compose.runtime.SideEffect
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
@ -12,6 +13,7 @@ import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
|
@ -69,12 +71,6 @@ fun LobstersApp(
|
||||||
) {
|
) {
|
||||||
ProvideWindowInsets {
|
ProvideWindowInsets {
|
||||||
val systemBarsColor = MaterialTheme.colorScheme.surfaceColorAtNavigationBarElevation()
|
val systemBarsColor = MaterialTheme.colorScheme.surfaceColorAtNavigationBarElevation()
|
||||||
|
|
||||||
SideEffect {
|
|
||||||
systemUiController.setStatusBarColor(color = systemBarsColor)
|
|
||||||
systemUiController.setNavigationBarColor(color = systemBarsColor)
|
|
||||||
}
|
|
||||||
|
|
||||||
val navItems =
|
val navItems =
|
||||||
listOf(
|
listOf(
|
||||||
NavigationItem(
|
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(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
ClawAppBar(
|
ClawAppBar(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue