|
|
|
@ -31,7 +31,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
|
|
|
|
|
import androidx.compose.material3.Icon
|
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
|
import androidx.compose.material3.Scaffold
|
|
|
|
|
import androidx.compose.material3.Surface
|
|
|
|
|
import androidx.compose.material3.Text
|
|
|
|
|
import androidx.compose.material3.windowsizeclass.WindowSizeClass
|
|
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
@ -73,6 +72,7 @@ fun NiaApp(
|
|
|
|
|
},
|
|
|
|
|
containerColor = Color.Transparent,
|
|
|
|
|
contentColor = MaterialTheme.colorScheme.onBackground,
|
|
|
|
|
contentWindowInsets = WindowInsets(0, 0, 0, 0),
|
|
|
|
|
bottomBar = {
|
|
|
|
|
if (appState.shouldShowBottomBar) {
|
|
|
|
|
NiaBottomBar(
|
|
|
|
@ -158,42 +158,32 @@ private fun NiaBottomBar(
|
|
|
|
|
onNavigateToDestination: (TopLevelDestination) -> Unit,
|
|
|
|
|
currentDestination: NavDestination?
|
|
|
|
|
) {
|
|
|
|
|
// Wrap the navigation bar in a surface so the color behind the system
|
|
|
|
|
// navigation is equal to the container color of the navigation bar.
|
|
|
|
|
Surface(color = MaterialTheme.colorScheme.surface) {
|
|
|
|
|
NiaNavigationBar(
|
|
|
|
|
modifier = Modifier.windowInsetsPadding(
|
|
|
|
|
WindowInsets.safeDrawing.only(
|
|
|
|
|
WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom
|
|
|
|
|
)
|
|
|
|
|
NiaNavigationBar {
|
|
|
|
|
destinations.forEach { destination ->
|
|
|
|
|
val selected =
|
|
|
|
|
currentDestination?.hierarchy?.any { it.route == destination.route } == true
|
|
|
|
|
NiaNavigationBarItem(
|
|
|
|
|
selected = selected,
|
|
|
|
|
onClick = { onNavigateToDestination(destination) },
|
|
|
|
|
icon = {
|
|
|
|
|
val icon = if (selected) {
|
|
|
|
|
destination.selectedIcon
|
|
|
|
|
} else {
|
|
|
|
|
destination.unselectedIcon
|
|
|
|
|
}
|
|
|
|
|
when (icon) {
|
|
|
|
|
is ImageVectorIcon -> Icon(
|
|
|
|
|
imageVector = icon.imageVector,
|
|
|
|
|
contentDescription = null
|
|
|
|
|
)
|
|
|
|
|
is DrawableResourceIcon -> Icon(
|
|
|
|
|
painter = painterResource(id = icon.id),
|
|
|
|
|
contentDescription = null
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
label = { Text(stringResource(destination.iconTextId)) }
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
destinations.forEach { destination ->
|
|
|
|
|
val selected =
|
|
|
|
|
currentDestination?.hierarchy?.any { it.route == destination.route } == true
|
|
|
|
|
NiaNavigationBarItem(
|
|
|
|
|
selected = selected,
|
|
|
|
|
onClick = { onNavigateToDestination(destination) },
|
|
|
|
|
icon = {
|
|
|
|
|
val icon = if (selected) {
|
|
|
|
|
destination.selectedIcon
|
|
|
|
|
} else {
|
|
|
|
|
destination.unselectedIcon
|
|
|
|
|
}
|
|
|
|
|
when (icon) {
|
|
|
|
|
is ImageVectorIcon -> Icon(
|
|
|
|
|
imageVector = icon.imageVector,
|
|
|
|
|
contentDescription = null
|
|
|
|
|
)
|
|
|
|
|
is DrawableResourceIcon -> Icon(
|
|
|
|
|
painter = painterResource(id = icon.id),
|
|
|
|
|
contentDescription = null
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
label = { Text(stringResource(destination.iconTextId)) }
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|