[img]https://i.sstatic .net/VCJR0agt.png[/img]
Я пробовал изменить высоту навигационной панели с помощью Modifier.height, но у нее есть ограничение, и значок сталкивается с текстом.
Это мой код:
Код: Выделить всё
@Composable
fun AppNavigation() {
val navController = rememberNavController()
Scaffold(
bottomBar = {
NavigationBar(
containerColor = MainWhite
) {
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = navBackStackEntry?.destination
listOfNavItems.forEach { navItem ->
val selected =
currentDestination?.hierarchy?.any { it.route == navItem.route } == true
NavigationBarItem(
selected = selected,
onClick = {
navController.navigate(navItem.route) {
popUpTo(navController.graph.findStartDestination().id) {
saveState = true
}
launchSingleTop = true
restoreState = true
}
},
icon = {
Icon(
if (selected) navItem.filledIcon else navItem.outlinedIcon,
contentDescription = navItem.description,
modifier = Modifier.size(30.dp),
)
},
label = {
Text(
text = navItem.label,
style = MaterialTheme.typography.bodyLarge,
fontSize = 12.sp,
fontWeight = FontWeight.SemiBold,
)
},
colors = NavigationBarItemDefaults.colors(
selectedIconColor = MainTurquoise,
selectedTextColor = MainTurquoise,
indicatorColor = MainWhite,
unselectedIconColor = MainGrey,
unselectedTextColor = MainGrey,
disabledIconColor = Color.Black,
disabledTextColor = Color.Black
)
)
}
}
}
) { paddingValues ->
NavHost(
navController = navController,
startDestination = Screen.HomeScreen.route,
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Start,
tween(100)
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Start,
tween(100)
)
},
popEnterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.End,
tween(100)
)
},
popExitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.End,
tween(100)
)
},
modifier = Modifier.padding(paddingValues)
) {
composable(route = Screen.HomeScreen.route) {
MainScreen()
}
composable(route = Screen.NewPostScreen.route) {
NewPostScreen()
}
composable(route = Screen.InboxScreen.route) {
InboxScreen()
}
composable(route = Screen.AccountScreen.route) {
AccountScreen()
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... material-3