commit 2b11dec050221ce6527f96f5cc96560294155462
parent 7b6b0bfd700f928870eb719c531fc1ced4f12c48
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Sun,  6 Aug 2023 15:55:06 +0200

fix: navigation bar label

Diffstat:
Mapp/src/main/kotlin/me/rhunk/snapenhance/ui/manager/Navigation.kt | 17+++--------------
1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/Navigation.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/Navigation.kt @@ -1,9 +1,7 @@ package me.rhunk.snapenhance.ui.manager -import androidx.compose.animation.core.animateDpAsState import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxHeight -import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.material.icons.Icons @@ -19,7 +17,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.navigation.NavDestination import androidx.navigation.NavDestination.Companion.hierarchy @@ -85,30 +82,22 @@ class Navigation( fun selected() = currentDestination?.hierarchy?.any { it.route == section.route } == true NavigationBarItem( + alwaysShowLabel = false, modifier = Modifier .fillMaxHeight(), icon = { - val iconOffset by animateDpAsState( - if (selected()) 0.dp else 10.dp, - label = "" - ) Icon( imageVector = section.icon, - contentDescription = null, - modifier = Modifier.offset(y = iconOffset) + contentDescription = null ) }, label = { - val labelOffset by animateDpAsState( - if (selected()) 0.dp else (-5).dp, - label = "" - ) Text( textAlign = TextAlign.Center, softWrap = false, fontSize = 12.sp, - modifier = Modifier.wrapContentWidth(unbounded = true).offset(y = labelOffset), + modifier = Modifier.wrapContentWidth(unbounded = true), text = if (selected()) context.translation["manager.routes.${section.route}"] else "", ) },