Closed tgyuuAn closed 11 months ago
BottomNavigation Visibility 애니메이션 부드럽게 만들기.
기존에는 BottomNavigation이 생기면 위의 Screen이 점프하는 현상이 생겼음.
AnimatedVisibility(
visible = bottomBarState,
enter = slideInVertically(initialOffsetY = { it }),
exit = slideOutVertically(targetOffsetY = { it }),
content = {
BottomNavigation(
backgroundColor = BaekyoungTheme.colors.white,
modifier = modifier
) {
TopLevelDestination.entries.forEach { destination ->
val isSelect = currentRoute == destination.route
BottomNavigationItem(
selected = isSelect,
onClick = { onNavigateToDestination(destination) },
selectedContentColor = BaekyoungTheme.colors.blueFF,
unselectedContentColor = BaekyoungTheme.colors.gray95,
icon = {
Icon(
painter = painterResource(id = destination.selectedIcon),
contentDescription = null,
)
},
label = {
Text(
text = stringResource(id = destination.titleTextId),
style = BaekyoungTheme.typography.labelNormal,
color = if (isSelect) BaekyoungTheme.colors.blueFF
else BaekyoungTheme.colors.gray95,
)
}
)
}
}
}
)
AnimatedContent(
targetState = bottomBarState,
label = "",
transitionSpec = {
slideInVertically { height -> height } with
slideOutVertically { height -> height }
},
content = { isVisible ->
if (isVisible) {
BottomNavigation(
backgroundColor = BaekyoungTheme.colors.white,
modifier = modifier
) {
TopLevelDestination.entries.forEach { destination ->
val isSelect = currentRoute == destination.route
BottomNavigationItem(
selected = isSelect,
onClick = { onNavigateToDestination(destination) },
selectedContentColor = BaekyoungTheme.colors.blueFF,
unselectedContentColor = BaekyoungTheme.colors.gray95,
icon = {
Icon(
painter = painterResource(id = destination.selectedIcon),
contentDescription = null,
)
},
label = {
Text(
text = stringResource(id = destination.titleTextId),
style = BaekyoungTheme.typography.labelNormal,
color = if (isSelect) BaekyoungTheme.colors.blueFF
else BaekyoungTheme.colors.gray95,
)
}
)
}
}
}
},
)
작업 사항
Todo
기타사항
-