mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-19 14:51:10 +02:00
Resets the bar visibility when switching screens.
This commit is contained in:
@@ -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?>,
|
||||
|
Reference in New Issue
Block a user