Heya! I’m having trouble wrapping my head around c...
# compose
v
Heya! I’m having trouble wrapping my head around centering a view vertically in dev06. It looks like this and my code is like this…
Copy code
Row {
        // ...
        Container(width = 48.dp, height = 48.dp) {
            DrawVector(profilePlaceholderImage)
        }
        Spacer(modifier = LayoutPadding(start = 16.dp))
        Column {
          //  ...
          drawNameAndStars()
        }
// This line of code isn't working as expected 
        Container(width = 14.dp, height = 14.dp, modifier = LayoutFlexible(1f) + LayoutAlign.CenterRight) {
            DrawVector(arrowVector)
        }
    }
m
LayoutGravity.Center is what you needed. I think the API is a bit confusing now
v
Thanks Minghao, I’ll give it a try
Looks like discoverability of
Modifiers
is about to change.
v
I see
z
Also, have you seen the
ListItem
composable? I believe it gives you exactly this layout, you don't need to write it yourself.
v
^good to know, I’ll see if the material folder has stuff i can use