Hello! I have a `List<@Composable () -> Unit...
# compose
b
Hello! I have a
List<@Composable () -> Unit>
. And I want to display it in a
LazyColumn
with a
Space
between each of them.
Copy code
LazyColumn {
  items(list) { composable ->
    composable.invoke()
    Space(height = 4.dp)
  }
}
The problem is that some of them can emit nothing to the tree. That means that visually I get double
Space
between some components. How would you avoid this problem? Those functions that emit nothing could start emitting at any point if their state change.
j
I think the only solution here is to move Space emitting to composable itself. There you can just do a simple if logic to handle that
t
Copy code
verticalArrangement = Arrangement.spacedBy(4.dp),
j
Will that solve the issue? Is arrangement ignoring "non emitting" items?
b
It does! Thanks! I assume that
verticalArragement
checks the tree instead of calls to
items
j
Interesting, TIL