Hey all, I’m using the Material ListItem ‘trailing...
# compose
t
Hey all, I’m using the Material ListItem ‘trailing’ property, and trying to align my trailing content in a column.. with difficulty
c
Show some code please!
t
Copy code
...
trailing = {
    Column(Modifier.height(72.dp), Arrangement.Center) {
        Button(onClick = { }) {
            Text(text = "60kg")
        }
    }
},
The parent definition for ‘trailing’ in a two item list is:
Copy code
OffsetToBaselineOrCenter(
    if (icon != null) {
        PrimaryBaselineOffsetWithIcon
    } else {
        PrimaryBaselineOffsetNoIcon
    }
    ) {
    Box(
        // TODO(popam): find way to center and wrap content without minHeight
        Modifier.heightIn(min = minHeight)
            .padding(end = TrailingRightPadding),
        contentAlignment = Alignment.Center
    ) { trailing() }
}
minHeight
should resolve to 72.dp. I can’t see any obvious reason why I can’t stick a Column inside that Box, and then align the contents of the column to center vertically. But, it’s about day 2 of compose so hopefully I’m about to find out!
Actually, I think the content is correctly centered in the column. It’s probably the layout of the column itself that is problematic
I dunno. Maybe this is due to the parent being a box.
¯\_(ツ)_/¯