Hello everyone, can someone help me with a layout ...
# compose
y
Hello everyone, can someone help me with a layout for a list row? I cannot wrap my head around it. I have a Row, which has 2 child Columns. First Column has a Text. The second Column has a Switch and a Text. The height of the Row should be defined by the height of the first column. I would like to make Switch and the Text in the second Column to have equal weights and to stretch. Can I achieve this with current state of Compose? Thank you.
j
If you can send a draft or something it'd be easier to help 👍
y
Code or image?
@Jorge Castillo Is this is what you had in mind as draft? 🙂
j
Yeah thanks. I'll try something.
What about something like this?
y
Awesome! Thank you!
I will take your solution as a basis and will work from there🙂
It worked well 🙂 Unfortunately, ConstraintSet is deprecated in dev14. Going to look into ConstraintLayoutDemo and DemoInlineDSL which are mentionen in dev14 KDoc.
j
Right. I didn't even look at what version I was using at that project. But I bet there are equivalents in dev14 if that's the case.
y
I ended up doing it this way:
Copy code
modifier = Modifier
  .constrainAs(weekDaysText) {
    top.linkTo(timeText.bottom)
    start.linkTo(parent.start)
    end.linkTo(switch.start)
    bottom.linkTo(parent.bottom)
    width = Dimension.fillToConstraints
  }
Copy code
constrainAs is available in ConstaintLayoutScope
j
Awesome