Why there is an `offset {}` modifier that accepts ...
# compose
g
Why there is an
offset {}
modifier that accepts lambda to skip straight to the placement stage, but no
size {}
modifier so I can also skip recomposition entirely?
m
There isn't a built-in one but you can make it yourself easily, or copy it from here: https://kotlinlang.slack.com/archives/C0B8M7BUY/p1741880176767509
g
@MR3Y Yeah, that basically the same way I implemented size {} in my project, but I got suspicious why there is no so obvious built in function
e
I imagine it's because size isn't supposed to change so frequently
plus1 1
a
https://issuetracker.google.com/345299387 is a tracking feature request for adding modifiers like these. Size can definitely change frequently, it’s more of an question of whether there should be lambda and non-lambda versions of every single modifier API that exists.
Modifier.layout
is the general way to customize layout behavior, it should be a go-to in cases like this where you want to fine-tune what happens in different phases
e
I thought there was guidance to use things like scale for these types of interactions?
a
Depends on what you’re doing - if you have a expanding/collapsing section, it definitely makes sense to have the size directly change for everything else to nicely move around it
👍 1
e
Imo, layout should be easier to use (or there should be a simpler version). That's why its not the goto modifier for these cases today