Anes
07/07/2020, 7:50 PMConstraintLayout(modifier = Modifier.padding(16.dp)) {
val (headerImage, title, subtitle, date, like) = createRefs()
val modifier = Modifier
.preferredHeight(180.dp)
.fillMaxWidth()
.clip(RoundedCornerShape(8.dp))
.constrainAs(headerImage) {
top.linkTo(parent.top)
centerHorizontallyTo(parent)
}
Image(
asset = image,
modifier = modifier,
contentScale = ContentScale.Crop
)
likeCounter(
isFavorite = isFavorite.value,
tintColor = colors.primary,
updateCounts = { newValue -> isFavorite.value = newValue },
modifier = Modifier.constrainAs(like) {
top.linkTo(headerImage.bottom)
end.linkTo(parent.end)
}
)
Text(
text = "Hello this is nothing from nothing withing " +
"nothing and usually besides nothing and embedded in nothing",
style = typography.h6,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.constrainAs(title) {
top.linkTo(headerImage.bottom)
start.linkTo(parent.start)
end.linkTo(like.start)
width to Dimension.fillToConstraints
}
)
}
aipok
07/08/2020, 12:39 AMwidth to Dimension.fillToConstraints
to width = Dimension.preferredWrapContent
it works just fineAnes
07/08/2020, 12:48 PMwidth to Dimension.preferredWrapContent
aipok
07/08/2020, 12:50 PM=
instead of to
I copied your code and it was working in my layout previewAnes
07/09/2020, 7:57 PM