I have this weird requirement where I have to give...
# compose
c
I have this weird requirement where I have to give a Box the same height that is equal to the total height of the 1st and 2nd item of a LazyCol on top of the box.. The 1st and 2nd item in the list can change at any time or else I would just try to take the easy route and use some hardcoded height. How can I properly set a variable of
totalHeightOfFirstAndSecondItemInLazyCol
.
Copy code
Box {
Box(fillMaxWidth().height(totalHeightOfFirstAndSecondItemInLazyCol)
LazyColumn() { //all items are different sizes }
}
s
Copy code
lazyListState.layoutInfo.visibleItemsInfo.let { 
    it.getOrNull(0)?.size?.plus(it.getOrNull(1)?.size ?: 0) ?: 0
}
?
🧠 1
c
Ooh. TIL. I think that'll work. Ill give it a shot when im back by my computer