I use the "fill everything up" spacer a lot and wa...
# compose
s
I use the "fill everything up" spacer a lot and want to define this for a util, but the "weight" method is not found. I guess because it depends on the scope. How must I modify this code so I can use
FillSpacer()
everywhere I would write the long form instead?
Copy code
@Composable
fun FillSpacer() =
    Spacer(modifier = Modifier.weight(1.0f))
1
f
Try
fun ColumnScope.FillSpacer()
(and equivalent for
RowScope
)
🙏 1
s
Thank you, that worked. 👍
Copy code
@Composable
fun ColumnScope.FillSpacer() =
    Spacer(modifier = Modifier.weight(1.0f))

@Composable
fun RowScope.FillSpacer() =
    Spacer(modifier = Modifier.weight(1.0f))
🎉 1