Alexa_Gal
02/03/2021, 2:09 AMModalBottomSheetLayout
? at the moment i only get the next view after the second click/composeAlexa_Gal
02/03/2021, 2:09 AMvar modalType: OptionSheet by remember { mutableStateOf(OptionSheet.Limits) }
Log.e("type", modalType.toString())
val state = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)
Surface(
modifier = Modifier
.fillMaxSize(),
color = Color.shade000
) {
ModalBottomSheetLayout(
sheetState = state,
sheetContent = {
when (modalType) {
OptionSheet.Limits -> {
LazyColumn {
for (i in 1..5) item {
ListItem(
text = { Text("Item $i") },
icon = { Icon(Icons.Default.Favorite, "") }
)
}
}
}
else -> {
Box(modifier = Modifier.size(100.dp))
}
}
}
) {
Column {
Spacer(Modifier.preferredHeight(100.dp))
Button({
withMutableSnapshot {
modalType = OptionSheet.Limits
state.show()
}
}) {
Text("Modal one")
}
Spacer(Modifier.preferredHeight(100.dp))
Button({
withMutableSnapshot {
modalType = OptionSheet.CompanyInfo
state.show()
}
}) {
Text("Modal Two")
}
}
}
}
Shakil Karim
02/03/2021, 5:24 AMknthmn
02/03/2021, 6:46 AMLaunchedEffect
as a workaround.