Skip to content

Instantly share code, notes, and snippets.

@MrNtlu
Created December 6, 2022 14:26
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 MrNtlu/3cb81fc76aeec04e344bf96d695decbb to your computer and use it in GitHub Desktop.
Save MrNtlu/3cb81fc76aeec04e344bf96d695decbb to your computer and use it in GitHub Desktop.
Bottom Sheet Activity Part 2
ModalBottomSheetLayout(
sheetState = modalSheetState,
sheetShape = RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp),
sheetContent = {
Column(
//...
) {
//...
Button(
onClick = {
coroutineScope.launch { modalSheetState.hide() }
}
) {
Text(text = "Hide Sheet")
}
}
}
) {
Scaffold {
Box(
//...
) {
Button(
onClick = {
coroutineScope.launch {
if (modalSheetState.isVisible)
modalSheetState.hide()
else
modalSheetState.animateTo(ModalBottomSheetValue.Expanded)
}
},
) {
Text(text = "Open Sheet")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment