Hello, how can I create a modifier that has 4 constraints:
• Tries to fill max width
• Has a horizontal padding
• Has a max width
Also the composable will be used inside a Column with a vertical scroll
✅ 1
Dragos Rachieru
09/05/2023, 8:49 AM
I tried using
fillMaxWidth
with
sizeIn
but it didn't work, I'm not sure why, the composable will use the parent's width
v
vide
09/05/2023, 9:10 AM
What do you mean with "tries to fill max width"? Relative to what?
vide
09/05/2023, 9:11 AM
fillMaxWidth()
refers to the incoming constraints. It's working as intended when it fills the parent's width.
vide
09/05/2023, 9:13 AM
If you want to disregard the parent's max bounds you can use
wrapContentSize(unbounded = true)
to ignore incoming constraints.
a
Albert Chang
09/05/2023, 9:18 AM
Just put
sizeIn
before
fillMaxWidth
.
➕ 1
✔️ 2
v
vide
09/05/2023, 9:23 AM
Ah, I just understood what you were actually asking. I somehow missed the point of filling but still having a max 😅