Karthick
02/12/2021, 5:24 AMShakil Karim
02/12/2021, 5:32 AMjim
02/12/2021, 8:55 AMI have a suggestion for ModalBottomSheetLayout, users should have explicitly pass sheet state. Because I called sheetState.show() without passing sheetState to ModalBottomSheetLayout because it has a default parameter value and getting exceptionSorry, I'm not sure I understand, can you elaborate in more detail? You get an exception when you do not pass a state?
Karthick
02/12/2021, 1:59 PM@Composable
@ExperimentalMaterialApi
fun ModalBottomSheetLayout(
sheetContent: @Composable ColumnScope.() -> Unit,
sheetState: ModalBottomSheetState =
rememberModalBottomSheetState(ModalBottomSheetValue.Hidden),
content: @Composable () -> Unit
)
val bottomSheet = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)
ModalBottomSheetLayout(
sheetContent = {
BottomSheetContent()
}
) {
Button(onClick = { bottomSheet.show() }){Text("Show Bottom Sheet")}
}