Skip to content

Instantly share code, notes, and snippets.

@shohiebsense
Created December 15, 2021 00:11
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 shohiebsense/583924d03023c8e23b85454f6f917f5f to your computer and use it in GitHub Desktop.
Save shohiebsense/583924d03023c8e23b85454f6f917f5f to your computer and use it in GitHub Desktop.
Custom Modal Bottom Sheet On Jetpack Compose
@Composable
fun SomePage(){
val animatedVisibility = produceState(initialValue = false){
delay(2000)
value = true
}
BoxWithConstraints{
...
//layout
if(animatedVisibility.value){
Box(modifier = Modifier.fillMaxSize().background( OnSurfaceColor.copy(alpha = 0.32f)))
}
AnimatedVisibility(animatedVisibility.value,
modifier = Modifier.align(Alignment.BottomCenter),
enter = slideInVertically(
initialOffsetY = { it/2 })
){
Box(modifier = Modifier.fillMaxWidth().height(200.dp).background(Color.White)){
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment