В своем приложении для Android я хочу скрыть нижнюю панель приложений для определенных экранов. Как мне быть??
Код: Выделить всё
@Composable
fun MainScreen() {
val isTeacher = IsUser()
var currentDestination by rememberSaveable { mutableStateOf(TeacherAppDestinations.Home) }
var canShowBottomNav by rememberSaveable { mutableStateOf(true) }
val adaptiveInfo = currentWindowAdaptiveInfo()
val customNavSuiteType = with(adaptiveInfo) {
if (windowSizeClass.windowWidthSizeClass == WindowWidthSizeClass.EXPANDED) {
NavigationSuiteType.NavigationRail
} else {
NavigationSuiteScaffoldDefaults.calculateFromAdaptiveInfo(adaptiveInfo)
}
}
NavigationSuiteScaffold(
layoutType = customNavSuiteType,
navigationSuiteItems = {
TeacherAppDestinations.entries.filter { it.forTeacher == isTeacher }.forEach { item ->
navItemEntry(
item = item,
selected = item == currentDestination,
onClick = {
currentDestination = item
}
)
}
}
) {
when (currentDestination) {
TeacherAppDestinations.Home -> HomeScreen(canShowBottomNav = {
canShowBottomNav = it
})
TeacherAppDestinations.Profile -> {
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text("Profile")
}
}
}
}
}
Может ли кто-нибудь предложить решение?
Подробнее здесь: https://stackoverflow.com/questions/790 ... tescaffold
Мобильная версия