I wanna constraint the Image's start to parent's start, top to top, end to end when its width/height is 4/3, just like app:layout_constraintDimensionRatio="H,3:4" in Android Xml.
Here's my code below :
ConstraintLayout(
modifier = Modifier
.wrapContentHeight()
.width(162.dp)
.clip(RoundedCornerShape(10.dp))
.background(color = Color.White)
.clickable {
//do something
}
) {
val (coverImg, title, status, date) = createRefs()
Image(
"some ignored properties",
modifier = Modifier
.constrainAs(coverImg) {
linkTo(start = parent.start, end = parent.end)
top.linkTo(parent.top)
width = Dimension.fillToConstraints
}
.height(102.dp)//I don't want to specify its height
)
Text(...)
AnyOtherLayout(...)
}

