Issue
Im trying to pass a list of Composables, in this case Columns, as a parameter to later populate a view, for that I'm adding the parameter List<@Composable (ColumnScope.() -> Unit)> on a composable function and populating a List with simple Columns.
The problem I'm having is that the Columns generate a Type mismatch
Required:
List<ColumnScope.() → Unit>
Found:
List<Unit>
Is there a way to achieve this? Here I'll provide my code.
@Composable
fun LotsOfColumns() {
ColumnListSample(
myColumns = listOf(
Column {},
Column {}
)
)
}
@Composable
fun ColumnListSample(
myColumns: List<@Composable (ColumnScope.() -> Unit)>,
modifier: Modifier = Modifier
) {}
Solution
@Composable fun LotsOfColumns() {
ColumnListSample(
myColumns = listOf(
{ Column {} },
{ Column {} }
)
)
}
Answered By - Remo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.