Alexis
01/25/2025, 5:56 PMhorizontalArrangement = Arrangement.SpaceEvenly
This row contains elements that can open a DropdownMenu, it seems that when a DropdownMenu is open, the Row's arrangement is changed to take the DropdownMenu into account: on the first screenshoot the 4 items are spaced correctly, but on the second screenshoot, the items are spaced like if there where 5 of them: there's an extra space between the earth and the translate icon.
For re-usability I call directly the following inside my Row():
@Composable
fun FilterEntry(
currentId: Int?,
elements: List<VisualAndText>,
onChange: (Int) -> Unit
) {
var showMenu by remember { mutableStateOf(false) }
elements.find { it.id == (currentId ?: -1) }?.let { current ->
IconButton(onClick = { showMenu = true }) {
Visual(
modifier = Modifier.size(40.dp),
image = current.visual
)
}
}
MyDropdownMenu(
expanded = showMenu,
onDismissRequest = { showMenu = false }
) {
elements.forEach { element ->
MyDropDownMenuItem(
visual = element.visual,
text = element.text,
onClick = { onChange(element.id); showMenu = false }
)
}
}
}
(MyDropdownMenu calls directly a regular MD3 DropdownMenu, same for MyDropDownMenuItem that calls a regular MD3 DropdownMenuItem.
Is it a bug with Compose, or am I not supposed to handle DropdownMenu like that?
Or maybe I'm missing something else, and the problem isn't related to the DropdownMenu?