Is it somehow possible to pass a value from a pare...
# compose
g
Is it somehow possible to pass a value from a parent composable draw scope to a child’s draw scope? I’d like to create (and cache) a
LinearGradient
brush in a parent draw modifier, and have a child composable’s draw modifier later use that same
LinearGradient
. (This would ensure that I have the same colours and size when the child uses it.) Follow up q: is there anything that I can use within a draw scope that would allow me to know the current composable’s coordinate offset relative to another parent? I.e. the compose equivalent of
offsetDescendantRect
I figured out a way I can do what I want (in theory). I can copy how `Scaffold`'s use of
AmbientFabPlacement
works, which lets child composables know information about where the fab is positioned using
SubcomposeLayout
a
reminds me of drawWithCache() but it's probably not what u need