Kata
02/16/2022, 8:01 AMconstraint layout
, linking the bottom view to the view on the top. This works fine until I decide not to display the top view for some reason. At this point the view at the bottom is not displayed at the right place. This makes sense since the Modifier.constrainAs
is not set up for the top view. What would be the correct solution for this issue?Kata
02/16/2022, 8:44 AMif (visible) {
Text(
text = "text",
modifier = Modifier.constrainAs(text) {
top.linkTo(title.bottom, 6.dp)
start.linkTo(title.start)
}
)
} else {
Spacer(
modifier = Modifier.constrainAs(text) {
top.linkTo(title.bottom)
start.linkTo(title.start)
}
)
}
This way the text
constraint works