Marko Novakovic
08/30/2022, 7:18 PM@Composable
fun Example() {
Row(modifier = Modifier.fillMaxWidth()) {
Text(
text = "Left",
modifier = Modifier.weight(1f),
)
Text(
text = "Right",
modifier = Modifier.weight(1f),
)
}
}
to:
@Composable
fun Example(
left: @Composable (Modifier) -> Unit,
right: @Composable (Modifier) -> Unit,
modifier: Modifier = Modifier,
) {
Row(modifier = modifier.fillMaxWidth()) {
left(Modifier.weight(1f))
right(Modifier.weight(1f))
}
}
am asking because of passing Modifier to parameter `@Composable`s.
I want to hide Modifier.weight(1f) and I want everything using Example to have exactly 2 elements that occupy 50%/50% of space, without wrapping left and right into Box, for example, and applying Modifier.weight(1f) to Box containerFilip Wiesner
08/30/2022, 7:23 PMMarko Novakovic
08/30/2022, 7:26 PMFilip Wiesner
08/30/2022, 7:29 PMExample to have exactly 2 elements"_ does not feel like good enough reason and it basically becomes just a Row wrapper
I would be interested in more information about why you want to avoid a custom layout?Filip Wiesner
08/30/2022, 7:31 PMFilip Wiesner
08/30/2022, 7:44 PMAlex Vanyo
08/30/2022, 7:45 PMwithout wrappingAlso curious for the reason for wanting to avoid that as well?andleftintorightBox
Marko Novakovic
08/30/2022, 7:59 PMleft and right should support layouts like Column, for example, and than (depending on what left and right are) alignment changes. it should support top and center vertical alignment etc. maybe it’s just too late and am overly complicating this in my head 😄Marko Novakovic
08/30/2022, 8:01 PMModifier back to parameter `@Composable`s but still wrongMarko Novakovic
08/30/2022, 8:03 PMFilip Wiesner
08/30/2022, 8:22 PMMarko Novakovic
08/30/2022, 8:28 PM