does anyone know how to do the equivalent of `layo...
# compose
g
does anyone know how to do the equivalent of
layout_weight
in a
Row
in dev04?
It looks like
FlexRow
used to be the solution but it’s deprecated in favour of
Row
now
a
the
FlexRow
options moved to the
LayoutFlexible
modifier that you can create in the row's receiver scope
e.g.
Copy code
Row {
  Text("Hello", LayoutFlexible(1f))
}
g
ah nice — thanks adam!
👍 1
a
ux researchy question: what did you try first/where did you look for this functionality first and why?
g
I was searching for the right modifier, just couldn’t find it. The word “flex” is just new to me (vs weight, fill, etc). I tried LayoutSize.FILL first fwiw. I’m just realising now about scoped modifiers too — took me a while to figure out how to use
LayoutGravity
because it was just a random object with no properties… it didn’t occur to me that extensions would apply within certain scopes! All makes sense now though 👍
a
yeah we're playing with some of these right now, hence the question. The scoping has positive properties of not being able to say nonsense in a layout where it wouldn't help you, (that is, the way you can put
android:layout_foo
anywhere and have it be silently ignored in layout xml if the parent doesn't support that param) but the tradeoff is discoverability. The
LayoutGravity
thing is probably on the side of way too cute for its own good; anything you can
this.
and find in autocomplete in these scopes is probably going to see some growth and movement
c
This is a really useful thread, but @Adam Powell, FWIW, this is my early experience with Compose: amazing how quickly you can whip things together, and totally rework them, but also ridiculous how much time you can burn looking for modifiers.
a
Yeah that was part of the motivation behind unifying some naming schemes. The same applies when looking for top level composable functions too.
👍🏻 1
r
And there's a lot we can do with documentation and tooling. Code completion could be a lot smarter about modifiers too
👍🏻 1
c
Yeah don’t want to say I thought it was a wash, definitely not, Compose allows a flowing experimental style that will totally transform development… super exciting… thanks for participating here too…
🎉 1