fix(ui): NavigationBarItem color

This commit is contained in:
junkfood 2024-01-31 23:01:59 +08:00 committed by Ash
parent a2f84965d3
commit 1dc906b84b
1 changed files with 10 additions and 6 deletions

View File

@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
@ -29,6 +30,11 @@ fun FilterBar(
) {
val view = LocalView.current
val themeIndex = LocalThemeIndex.current
val indicatorColor = if (themeIndex == 5 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
MaterialTheme.colorScheme.secondaryContainer
} else {
MaterialTheme.colorScheme.primaryContainer
} onDark MaterialTheme.colorScheme.secondaryContainer
NavigationBar(
modifier = Modifier
@ -75,12 +81,10 @@ fun FilterBar(
filterOnClick(item)
},
colors = NavigationBarItemDefaults.colors(
indicatorColor = if (themeIndex == 5 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
MaterialTheme.colorScheme.secondaryContainer
} else {
MaterialTheme.colorScheme.primaryContainer
} onDark MaterialTheme.colorScheme.secondaryContainer,
),
indicatorColor = indicatorColor,
unselectedIconColor = MaterialTheme.colorScheme.onSurfaceVariant,
selectedIconColor = MaterialTheme.colorScheme.contentColorFor(indicatorColor)
)
)
}
Spacer(modifier = Modifier.width(filterBarPadding))