Open and dismiss
A Button opens the sheet; selecting an action animates it closed.
val sheetState = rememberModalBottomSheetState()
val scope = rememberCoroutineScope()
var open by remember { mutableStateOf(false) }
Button(onClick = { open = true }) { Text("Show actions") }
if (open) {
ModalBottomSheet(onDismissRequest = { open = false }, sheetState = sheetState) {
ListItem(
headlineContent = { Text("Share") },
leadingContent = { Icon(Icons.Filled.Share, null) },
modifier = Modifier.clickable {
scope.launch { sheetState.hide() }
.invokeOnCompletion { open = false }
}
)
}
}