Pablo
03/18/2022, 10:35 AMwidth = Dimension.fillToConstraint
and then say that the first box has the min width as the second Box? The only constraint is that the first box can group and it makes the second one bigger, but the min width of the first one should be the same width as the second box. I add a reproducible code down below.
ConstraintLayout() {
val (title, description) = createRefs()
Box(
modifier = Modifier
.padding(start = 4.dp)
.background(color = Red)
.padding(horizontal = 16.dp)
.constrainAs(title) {
top.linkTo(<http://parent.top|parent.top>)
start.linkTo(parent.start)
end.linkTo(parent.end)
width = Dimension.fillToConstraints
},
contentAlignment = Alignment.Center
) {
Text(text = "Dynamic value", maxLines = 1)
}
Box(
modifier = Modifier
.padding(end = 4.dp)
.background(Color.Magenta)
.padding(
bottom = 5.dp, start = 8.dp, end = 16.dp, top = 4.dp
)
.constrainAs(description) {
top.linkTo(<http://title.top|title.top>, margin = 16.dp)
start.linkTo(parent.start)
end.linkTo(parent.end)
bottom.linkTo(parent.bottom)
},
contentAlignment = Alignment.Center
) {
Text(text = "Fixed Value")
}
}