mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-20 18:51:12 +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.material.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.derivedStateOf
|
import androidx.compose.runtime.derivedStateOf
|
||||||
@@ -216,12 +217,15 @@ fun MainScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val shouldShow = remember {
|
val shouldShow = remember {
|
||||||
derivedStateOf {
|
derivedStateOf {
|
||||||
abs(bottomBarOffsetHeightPx.value) < bottomBarHeightPx / 2.0f
|
abs(bottomBarOffsetHeightPx.value) < bottomBarHeightPx / 2.0f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WatchNavStateToUpdateBarVisibility(navState, bottomBarOffsetHeightPx)
|
||||||
|
|
||||||
ModalBottomSheetLayout(
|
ModalBottomSheetLayout(
|
||||||
sheetState = sheetState,
|
sheetState = sheetState,
|
||||||
sheetContent = {
|
sheetContent = {
|
||||||
@@ -314,6 +318,13 @@ fun MainScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun WatchNavStateToUpdateBarVisibility(navState: State<NavBackStackEntry?>, bottomBarOffsetHeightPx: MutableState<Float>) {
|
||||||
|
LaunchedEffect(key1 = navState.value) {
|
||||||
|
bottomBarOffsetHeightPx.value = 0f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun FloatingButtons(
|
fun FloatingButtons(
|
||||||
navEntryState: State<NavBackStackEntry?>,
|
navEntryState: State<NavBackStackEntry?>,
|
||||||
|
Reference in New Issue
Block a user