I'm using `DropDownMenuItem` with a `Text` in a `D...
# compose
p
I'm using
DropDownMenuItem
with a
Text
in a
DrowpDownMenu
, and I need to reduce the
DropDownMenuItem
height to the height of the
Text
, or with a minimum padding of
2.dp
. Now the height of the
DropDownMenuItem
is very big on big screens. Is double of the height of the
Text
. Also, the parent
DrowpDownMenu
is adding even more height. How can that height be reduced to the
Text
height? I already tryed setting a modifier with padding 0.dp to both, with no results.
Copy code
Box { 
    TextButton(onClick = { expandedFile = !expandedFile }) {
        Text(stringResource(Res.string.menu_file))
    }
    DropdownMenu(
        expanded = expandedFile,
        onDismissRequest = { expandedFile = false }
    ) {
        DropdownMenuItem(
            text = { Text(stringResource(Res.string.exit)) },
            onClick = {
                expandedFile = false
                onExitEvent()
            }
        )
    }
}
s
DropdownMenu and DropdownMenuItem are Material design components ,If you don't like its design token,you should try other ui components
p
but they should be able to accept modifiactions like height, or is not possible?
s
It not possible ,you can browse its source code
Maybe you can try Modifer.minHeight
DropdownMenuItem(modifer = Modifier.minHeight(32.dp))
p
don't work. I tryed everything:
Copy code
modifier = Modifier.background(Color.Blue).padding(0.dp).sizeIn(minHeight = 0.dp).wrapContentHeight().height(IntrinsicSize.Min),