Is it possible to create a lambda based modifier f...
# compose
v
Is it possible to create a lambda based modifier for padding like
Modifier.padding { }
I have a padding value which animates and due to that
Modifier.padding(..)
created recompositions
👀 1
z
Absolutely. Also note that PaddingValues is also an interface that can evaluate each individual value lazily.
m
Wouldn't the padding affect the interior calculated dimensions and require a recomposition of children anyway? (Unless the padding on one side were to grow/shrink to exactly balance changes in the padding on the other side, in which case wouldn't
.offset { }
work just as well?) (I feel like I must be missing something obvious here)
z
Layout changes don’t trigger recomposition unless: 1. you’re using layout-based subcomposition, like BoxWithConstraints, or 2. You are writing into some state object from layout that you read in composition
m
Ah, of course, I was mixing up the layout and composition phases. I should probably wait a few more minutes after waking up before using Slack 😅
😂 1