mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-27 18:22:31 +01:00
Resets the bar visibility when switching screens.
This commit is contained in:
parent
ff82b52a5b
commit
71db62e5a5
@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.statusBarsPadding
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.derivedStateOf
|
||||
@ -216,12 +217,15 @@ fun MainScreen(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val shouldShow = remember {
|
||||
derivedStateOf {
|
||||
abs(bottomBarOffsetHeightPx.value) < bottomBarHeightPx / 2.0f
|
||||
}
|
||||
}
|
||||
|
||||
WatchNavStateToUpdateBarVisibility(navState, bottomBarOffsetHeightPx)
|
||||
|
||||
ModalBottomSheetLayout(
|
||||
sheetState = sheetState,
|
||||
sheetContent = {
|
||||
@ -314,6 +318,13 @@ fun MainScreen(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun WatchNavStateToUpdateBarVisibility(navState: State<NavBackStackEntry?>, bottomBarOffsetHeightPx: MutableState<Float>) {
|
||||
LaunchedEffect(key1 = navState.value) {
|
||||
bottomBarOffsetHeightPx.value = 0f
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun FloatingButtons(
|
||||
navEntryState: State<NavBackStackEntry?>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user