Vinay Gaba
08/27/2023, 4:18 AM@Composable
fun MyCustomLayout(
slot1: @Composable CustomScope1.() -> Unit,
....
) {...}
There are some guarantees about what's being passed in that slot. I need some information about part (children) of the slot and access them in the custom layout so that I could measure the dimension of the "sub-child" that's being passed in slot1 (it's not the entire composable that's being passed inside slot1, but part of it). Wrapping this subcomponent with a Box and tagging it with layoutId
isn't enough because that information is lost when accessed in this custom layout. What's the best way to accomplish what I'm trying to do?
Asked differently, how could I access information about the children of the slot that's being passed to my custom layout. I'm primarily interested in being able to derive dimensions of this child composable inside the slotAlbert Chang
08/27/2023, 7:03 AMslot1
, you can use a custom layout that updates the states of a state holder after measuring the children, and then read the states in MyCustomLayout
, or use `AlignmentLine`s to pass the positions.xoangon
08/27/2023, 7:07 AMVinay Gaba
08/27/2023, 8:06 PMVinay Gaba
08/27/2023, 8:08 PMVinay Gaba
08/27/2023, 9:22 PMStylianos Gakis
08/27/2023, 10:30 PMAlbert Chang
08/28/2023, 4:28 AM