Elyes Mansour
03/13/2025, 3:36 PM// regular modifier
Modifier.size(size)
// new modifier
Modifier.size { size }
// there are also equivalents for width and height
I've shared the code here in this gist which you are free to copy https://gist.github.com/elyesmansour/43160ae34f7acbec19441b5c1c6de3ab ๐Jonas B
03/14/2025, 9:10 AMElyes Mansour
03/14/2025, 9:18 AMlayout
modifier, but that code can be cumbersome to write every time.
So I decided to just write these handful of modifiers that do the heavy lifting for us and are as easy to use as the regular ones we're used to.
The only difference is that they only animate the size during the layout phase without causing performance issues.
The reason why they can animate the changes during the layout phase instead of composition phase, is because the state read is deferred thanks to passing a lambda instead of the direct state value.Jonas B
03/14/2025, 9:20 AMOleg
03/15/2025, 9:41 AMElyes Mansour
03/15/2025, 9:51 AM