Created
December 15, 2021 00:11
-
-
Save shohiebsense/583924d03023c8e23b85454f6f917f5f to your computer and use it in GitHub Desktop.
Custom Modal Bottom Sheet On Jetpack Compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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