Writing a custom Layout, in order to be able to reference it back in the layout block, I am wrapping it in a box with a layoutId
Layout(content = { Box(Modifier.layoutId("id")) { content() }
and then in the block I do
measurables.fastFirstOrNull { it.layoutId == "id }
to find it.
This works well to get the item that I want (this layout takes more than 1 slot), but it breaks another assumption, regarding the modifier that is used in the call site for
content
. In particular, I got a modifier that animates the placement offset the item gets, but this is broken because in my custom layout I am now laying out the Box actually, and not the content itself.
Is there something clever I can do here to still get the layout ID to my composable, without breaking what I describe above?