Skip to content

Instantly share code, notes, and snippets.

@mazzouzi
Last active October 6, 2022 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazzouzi/a3160d7b56612890b88098fe3a092542 to your computer and use it in GitHub Desktop.
Save mazzouzi/a3160d7b56612890b88098fe3a092542 to your computer and use it in GitHub Desktop.
Toolbar composable
@Composable
private fun Toolbar(scroll: ScrollState, headerHeightPx: Float, toolbarHeightPx: Float) {
val toolbarBottom = headerHeightPx - toolbarHeightPx
val showToolbar by remember {
derivedStateOf { scroll.value >= toolbarBottom }
}
AnimatedVisibility(
visible = showToolbar,
enter = fadeIn(animationSpec = tween(300)),
exit = fadeOut(animationSpec = tween(300))
) {
.
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment