Looks like Compose Multiplatform doesn’t support `...
# compose
j
Looks like Compose Multiplatform doesn’t support
ConstraintLayout
for non-android targets. I’m still learning Compose, and I’m a little stuck in my old XML ways and very used to ConstraintLayout. How would I go about making something similar in Compose? Specifically, lets say I have a
Column
that has
Modifier.fillMaxSize()
. And I wanted to add a title
Text
composable a third of the way down from the top. Surely I could use padding, but that wouldn’t always be a third of the way down. I’m sure it can be done using
Box
, I’m just not familiar with it. Any tips, or links to this type of stuff? I don’t really know what to call it. In ConstraintLayout you would use a
Guideline
set to
0.3f
.
j
if your
Text
composable is the first one in the column then you can just use a spacer, something like this:
Copy code
Column(modifier = Modifier.fillMaxWidth()) {
    Spacer(modifier = Modifier.fillMaxHeight(0.3f)) // spacer fills 30% of available height
    Text(...)
}
e
that places the Text below the 30% mark. if you want to have 30% of the free space above the text, then you can use weight on the spacer, same as LinearLayout in legacy Android views