Fin
05/20/2024, 4:22 AMweight
which are only available within Row and Column scopes. Is there dynamic way of telling composables that they are currently in a specific scope? I tried utilizing context(RowScope)
annotation for methods, but that requires me to create a method for each scope. Is there any better flexible way?
Basically if( parent is Row) { add 'weight' to current composable }
Thank you 🙏Elliot Murray
05/20/2024, 9:10 AMif(this is RowScope)
should work?Fin
05/20/2024, 12:52 PM@Composable
fun BuildRowLayout(
modifier: Modifier,
content: List<Pair<@Composable (Modifier) -> Unit, Component>>?,
component: Component,
) {
Row(
modifier = modifier.applyStyle(
style = component.styles,
),
...
) {
content?.map {
if (requiresWeight(it.second.styles)) {
it.first.invoke(Modifier.weight(1f))
} else {
it.first.invoke(Modifier)
}
}
}
}
Zach Klippenstein (he/him) [MOD]
05/20/2024, 1:55 PMZach Klippenstein (he/him) [MOD]
05/20/2024, 1:56 PMpropagateMinConstraints=true
.Zach Klippenstein (he/him) [MOD]
05/20/2024, 3:41 PM