-
-
Save ssindher11/539e22892b42e788730657c9d44d096d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConstraintLayout(modifier = Modifier.constrainAs(castContainer) { | |
bottom.linkTo(coverImage.bottom) | |
start.linkTo(coverImage.end, 16.dp) | |
end.linkTo(parent.end, 16.dp) | |
width = Dimension.fillToConstraints | |
}) { | |
Image( | |
painter = painterResource(id = R.drawable.cast1), | |
contentDescription = null, | |
contentScale = ContentScale.Crop, | |
modifier = Modifier | |
.height(50.dp) | |
.constrainAs(castImage1) { | |
top.linkTo(parent.top) | |
bottom.linkTo(parent.bottom) | |
start.linkTo(coverImage.end, 16.dp) | |
} | |
.aspectRatio(1f) | |
) | |
Image( | |
painter = painterResource(id = R.drawable.cast2), | |
contentDescription = null, | |
contentScale = ContentScale.Crop, | |
modifier = Modifier | |
.height(50.dp) | |
.constrainAs(castImage2) { | |
top.linkTo(castImage1.top) | |
bottom.linkTo(castImage1.bottom) | |
start.linkTo(castImage1.end) | |
} | |
.aspectRatio(1f) | |
) | |
Image( | |
painter = painterResource(id = R.drawable.cast3), | |
contentDescription = null, | |
contentScale = ContentScale.Crop, | |
modifier = Modifier | |
.height(50.dp) | |
.constrainAs(castImage3) { | |
top.linkTo(castImage1.top) | |
bottom.linkTo(castImage1.bottom) | |
start.linkTo(castImage2.end) | |
} | |
.aspectRatio(1f) | |
) | |
Box(modifier = Modifier | |
.height(50.dp) | |
.background(color = colorResource(id = R.color.gray)) | |
.constrainAs(castImage4) { | |
top.linkTo(castImage1.top) | |
bottom.linkTo(castImage1.bottom) | |
start.linkTo(castImage3.end) | |
end.linkTo(parent.end, 16.dp) | |
} | |
.aspectRatio(1f)) | |
{ | |
Text( | |
text = "+9", | |
textAlign = TextAlign.Center, | |
fontSize = 14.sp, | |
modifier = Modifier | |
.padding(horizontal = 4.dp) | |
.align(Alignment.Center), | |
color = Color.Black | |
) | |
} | |
createHorizontalChain( | |
castImage1, castImage2, castImage3, castImage4, | |
chainStyle = ChainStyle.SpreadInside | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment