Guy Bieber
08/26/2020, 4:49 PM@Sampled
@Composable
fun BottomDrawerSample() {
val drawerState = rememberBottomDrawerState(BottomDrawerValue.Closed)
BottomDrawerLayout(
drawerState = drawerState,
drawerContent = {
Button(
modifier = Modifier.gravity(Alignment.CenterHorizontally).padding(top = 16.dp),
onClick = { drawerState.close() },
content = { Text("Close Drawer") }
)
},
bodyContent = {
Column(
modifier = Modifier.fillMaxSize().padding(16.dp),
horizontalGravity = Alignment.CenterHorizontally
) {
Text(text = if (drawerState.isClosed) "▲▲▲ Pull up ▲▲▲" else "▼▼▼ Drag down ▼▼▼")
Spacer(Modifier.preferredHeight(20.dp))
Button(onClick = { drawerState.open() }) {
Text("Click to open")
}
}
}
)
}
When I pass in a structure with a mutablestate for the drawer value I can’t open the drawer programmatically. What’s th deal with the special function?