fabio.carballo
10/21/2020, 9:26 PMVerticalButtonContainer(
top = {
TertiaryButton(
text = "Tertiary",
onClick = { },
)
},
bottom = {
PrimaryButton(
text = "Primary",
onClick = {},
)
}
)
@Composable
fun VerticalButtonContainer(
top: @Composable () -> Unit,
bottom: @Composable () -> Unit
) {
Column(
Modifier
.fillMaxWidth()
.padding(16.dp)
) {
top()
Spacer(Modifier.height(16.dp))
bottom()
}
}
In this case both top
and bottom
would ideally expand to the max width of the container. However (naturally) the buttons are still wrapping the content. Any way I can tweak the internals of this VerticalButtonContainer
to force the children to expand the width?Adriano Celentano
10/21/2020, 10:25 PM@Composable
private fun Sample() {
VerticalButtonContainer(
top = {
Button(
modifier = it.background(color = Color.Green),
onClick = {}
) {
Text(text = "test")
}
},
bottom = {
Button(
modifier = it.background(color = Color.Green),
onClick = {}
) {
Text(text = "test")
}
}
)
}
@Composable
fun VerticalButtonContainer(
top: @Composable (modifier: Modifier) -> Unit,
bottom: @Composable (modifier: Modifier) -> Unit
) {
Column(
Modifier
.fillMaxSize()
) {
top(Modifier.fillMaxWidth())
Spacer(Modifier.height(16.dp))
bottom(Modifier.fillMaxWidth())
}
}
Adriano Celentano
10/21/2020, 10:27 PMfabio.carballo
10/22/2020, 6:28 AM