Is there a way to either change the center of a co...
# compose
d
Is there a way to either change the center of a component or center a specific item in a row, with other items to either side of it? I'd like to make a specific word be the center of a Text, essentially.
The goal is to have the highlighted text be centered in each row.
I'm not on Android, so no ConstraintLayout
p
What about using multiple columns and rows?
d
In what way? You can h-center a thing in a column, but not put anything to either side since it's a Column. And you can't h-center a specific thing in a Row.
f
You're probably better off writing a Layout so that you can measure and lay out the children as you need. You can only do so much with columns and rows.
d
Thank you, I looked into it and it's easier than I expected: https://developer.android.com/jetpack/compose/layouts/custom Still, probably not worth the time, I'll chuck it on my "wait until Compose is more mature" list 😄
hadn't even considered the possibility of a custom layout, assuming it would be harder than that
f
Yes, it's surprisingly simple, a welcome change from the view system's ViewGroup
c
Still, probably not worth the time, I’ll chuck it on my “wait until Compose is more mature” list
I don’t think this will necessarily be a “maturity” issue though as it’s a special case beyond Row/Column, and can be done relatively easily with a custom layout. Because of that, the priority of making this official or an added feature in Compose libraries is likely quite low since one can compose these things themselves for their specific use cases.
But, if you feel strongly that this should be part of Compose core layout libraries, please file a request on our tracker
d
I said that because this is a relatively trivial thing to do in Android using ConstraintLayout.
and I'm hoping that CL comes to CfD at some point
if not as first-party, then as a third-party library, which is still a "maturity" thing, building up that ecosystem of libraries
c
Gotcha. I'm hoping as well though the team is a bit constrained at the moment (no pun intended)
😆 1