https://kotlinlang.org logo
#compose
Title
# compose
t

Timo Drick

06/25/2020, 12:04 PM
I cannot find the constructor for
androidx.ui.core.LayoutNode(modifier = currentComposer.materialize(modifier), measureBlocks = measureBlocks) { childrend() }
Which is used in many base composable components. I would like to use especially the way LayzyItems using it to be able to add and remove Nodes during measurement runs. Why is it hidden from the Public API? Or maybe i just missed something?
s

shikasd

06/25/2020, 12:07 PM
It's a trick of compiler plugin, this call gets replaced with
composer.emit
🙂
Actually it doesn't happen on current dev, they have removed it recently
t

Timo Drick

06/25/2020, 12:10 PM
ok nice. So it will be available in the next dev release?
s

shikasd

06/25/2020, 12:11 PM
You can call it right now actually, just follow the same pattern as they do
https://twitter.com/intelligibabble/status/1273339533891788800 Leland tweeted about this recently with more details
t

Timo Drick

06/25/2020, 12:19 PM
Interesting but it looks like that the keyword emit is also hidden.
s

shikasd

06/25/2020, 12:27 PM
Yeah, but before that you can use just constructor as it is now, it should be compiled correctly
a

Andrey Kulikov

06/25/2020, 12:31 PM
out of curiosity, what use case are you trying to solve?
t

Timo Drick

06/25/2020, 12:45 PM
I do have a custom implementation of the AdapterLIst (LazyColumn/Row-Items) with more features. I am using the Layout() composable as base currently. But it is a little bit tricky to get the child nodes in sync with the measurement code. I have to add tags to the child item nodes. (https://gitlab.com/timod/compose-playground/-/blob/master/compose_list/src/main/java/de/drick/compose/list/LayoutList.kt)
Ok thank you very much guys. Android Studio show every thing red but it compiles and works. (Just replecated the Layout() composable for now.