Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Composable
fun GameDetails(
gameDetails: GameDetailsEntity,
openGameTrailer: () -> Unit
) {
val scrollState = rememberScrollState()
Column(
modifier =
Modifier.fillMaxSize()
.verticalScroll(scrollState)
) {
ConstraintLayout {
val (play, gameImage) = createRefs()
// Game image
GameImage(
image = gameDetails.backgroundImage,
modifier =
Modifier.constrainAs(gameImage) {
top.linkTo(parent.top)
start.linkTo(parent.start)
end.linkTo(parent.end)
}
)
// Play button
PlayTrailer(
openGameTrailer = openGameTrailer,
modifier =
Modifier.constrainAs(play) {
top.linkTo(gameImage.bottom)
start.linkTo(parent.start)
end.linkTo(parent.end)
bottom.linkTo(gameImage.bottom)
}
)
}
// remaining children same as before
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment