any reason why I can’t find the `weight` Modifier?...
# compose
o
any reason why I can’t find the
weight
Modifier? just goes unresolved, no hint to import or anything, using Compose
1.0.5
z
Its only available inside the
content
block for Column/Row by way of their scopes. The scope provides this function
Copy code
@Stable
fun Modifier.weight(
    /*@FloatRange(from = 0.0, fromInclusive = false)*/
    weight: Float,
    fill: Boolean = true
): Modifier
o
yea like here
Copy code
Column(modifier = Modifier.weight(1f)) {
            Text(text = "Hello")
            Text(text = name)
        }
right?
t
Copy code
Column() {
            Text(text = "Hello", Modifier.weight(1f))
            Text(text = name, Modifier.weight(1f))
        }
Like this
m
No, inside the
{ }
of a Column. Unless your Column is in another Column (or Row)
o
then the tutorial is outdated
m
In the tutorial that Column that uses weight modifier is in a Row, so everything is fine
o
no, I’m blind, they placed the whole thing in a Row and then accessed weight
🕵️‍♂️ 1
👍 1
yea just like in normal views
613 Views