From 1dc906b84b1537d0eaf4f1025b7cae0b1ccd17fd Mon Sep 17 00:00:00 2001 From: junkfood <69683722+JunkFood02@users.noreply.github.com> Date: Wed, 31 Jan 2024 23:01:59 +0800 Subject: [PATCH] fix(ui): NavigationBarItem color --- .../java/me/ash/reader/ui/component/FilterBar.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/me/ash/reader/ui/component/FilterBar.kt b/app/src/main/java/me/ash/reader/ui/component/FilterBar.kt index 249d1f2a2..32b066bae 100644 --- a/app/src/main/java/me/ash/reader/ui/component/FilterBar.kt +++ b/app/src/main/java/me/ash/reader/ui/component/FilterBar.kt @@ -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))