I’m very curious about this question… Should it be a simple thing? <https://stackoverflow.com/questi...
n
a
No, you're not meant to be able to ask this. If you were able to and this practice were encouraged it would be prohibitively difficult to write UI code that composes with UI code written by others, or to combine libraries that are unaware of one another
👍 1
This is why Android View padding is frighteningly complex - it permits querying padding and the set of things considered "padding" is unexpectedly large, and has to be for correctness
Padding is an instruction to compose's layout system to subtract available space from an element during measurement and to position the final measured element within a larger space. It is far from the only such instruction available, and app or library code can create their own as well.
It's kind of like asking, "if I have a
Flow<T>
, how do I get the `.filter`s applied when I
collect
it?" Not knowing that is a desirable part of the abstraction.
And whatever you might try to do with that info is almost certainly brittle and wrong. 🙂
n
Thanks @Adam Powell 👍
👍 1
v
If i want to test if my padding is applied correctly in instrumentation testing... how to do that? (other than screenshot testing)
@Adam Powell