a

    alorma

    1 year ago
    Hi! Anyone has an example on how to show a Modal bottom sheet ? I think i'm doing something wrong.. .but cannot find what is, code in thread
    val coroutineScope = rememberCoroutineScope()
    val bottomSheetState = rememberModalBottomSheetState(
        initialValue = ModalBottomSheetValue.Hidden,
    )
    ModalBottomSheetLayout(sheetContent = { Text("Hello!") }) {
        Button(onClick = {
            coroutineScope.launch {
                if (bottomSheetState.isVisible) {
                    bottomSheetState.hide()
                } else {
                    bottomSheetState.show()
                }
            }
        }) {
            if (bottomSheetState.isVisible) {
                Text(text = "Hide")
            } else {
                Text(text = "Show")
            }
        }
    }
    m

    ms

    1 year ago
    You need to pass the
    bottomSheetState
    as parameter to
    ModalBottomSheetLayout
    a

    alorma

    1 year ago
    oooooh
    that makes sense ¬¬
    of course
    thanks @ms