In Jetpact Compose 1.0.0-alpha11, the below is valid code
DropdownMenu(
toggle = {
Text(
text = selected.value.toString(),
modifier = Modifier.clickable(onClick = { showMenu = true }),
fontSize = 16.sp
)
},
expanded = showMenu,
onDismissRequest = { showMenu = false },
toggleModifier = Modifier.background(Color.LightGray)
) {
items.forEachIndexed { index, s ->
DropdownMenuItem(
onClick = {
selected.value = items[index]
showMenu = false
}
) {
Text(text = s.toString())
}
}
}
However, after migrated to Jetpact Compose 1.0.0-beta07, the toggle
and toggleModifier
is no longer supported.
What's the new way of using DropdownMenu
?
The
toggle
andtoggleModifier
parameters were removed fromDropdownMenu
with1.0.0-alpha12
. They were not replaced.You have to do something different like: