mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 08:17:04 +05:30
android: use the correct nav color and make the check fancier
This commit is contained in:
parent
f03a55543e
commit
d15bf23eee
1 changed files with 3 additions and 3 deletions
|
@ -14,7 +14,6 @@ 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.LocalConfiguration
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
|
@ -75,6 +74,7 @@ fun LobstersApp(
|
|||
ProvideWindowInsets {
|
||||
val currentUiMode = LocalConfiguration.current.uiMode
|
||||
val systemBarsColor = MaterialTheme.colorScheme.surfaceColorAtNavigationBarElevation()
|
||||
val backgroundColor = MaterialTheme.colorScheme.background
|
||||
val navItems =
|
||||
listOf(
|
||||
NavigationItem(
|
||||
|
@ -94,8 +94,8 @@ fun LobstersApp(
|
|||
// Track UI mode as a key to force a navbar color update when dark theme is toggled
|
||||
LaunchedEffect(currentDestination, currentUiMode) {
|
||||
val color =
|
||||
if (currentDestination !in navItems.map { it.route }) {
|
||||
Color.Transparent
|
||||
if (navItems.none { item -> item.route == currentDestination }) {
|
||||
backgroundColor
|
||||
} else {
|
||||
systemBarsColor
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue