Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Initial game details screen
@Composable
fun GameDetails(
gameDetails: GameDetailsEntity,
openGameTrailer: () -> Unit
) {
Column(modifier = Modifier.fillMaxSize()) {
// Game image
GameImage(image = gameDetails.backgroundImage)
// Play button
PlayTrailer(openGameTrailer = openGameTrailer)
// Title
Text(
modifier =
Modifier.padding(
start = 16.dp,
top = 30.dp,
end = 16.dp
),
text = gameDetails.name,
color = Color.Black,
fontWeight = FontWeight.Bold,
fontSize = 20.sp
)
// Genres
Text(
modifier = Modifier.getDetailsModifier(),
text = gameDetails.genresEntity.toGenres()
)
// Released and rating info
ReleaseRating()
// About
Text(
modifier =
Modifier.padding(
start = 16.dp,
top = 16.dp,
end = 16.dp
),
text = "About",
color = Color.Black,
fontWeight = FontWeight.Bold,
fontSize = 20.sp
)
//Description with show more/less toggle
GameDescription(gameDetails.description)
// Platforms info
Text(
modifier = Modifier.getDetailsModifier(),
text = "Platforms",
color = Color.Black,
fontWeight = FontWeight.Bold,
fontSize = 20.sp
)
Text(
modifier = Modifier.getDetailsModifier(),
text = gameDetails.platformsEntity.toPlatforms()
)
// Stores
Text(
modifier = Modifier.getDetailsModifier(),
text = "Stores",
color = Color.Black,
fontWeight = FontWeight.Bold,
fontSize = 20.sp
)
Text(
modifier = Modifier.getDetailsModifier(),
text = gameDetails.storesEntity.toStores()
)
// Developer
Text(
modifier = Modifier.getDetailsModifier(),
text = "Developer",
color = Color.Black,
fontWeight = FontWeight.Bold,
fontSize = 20.sp
)
Text(
modifier = Modifier.getDetailsModifier(),
text =
gameDetails.developersEntity.toDevelopers()
)
// Publisher
Text(
modifier = Modifier.getDetailsModifier(),
text = "Publisher",
color = Color.Black,
fontWeight = FontWeight.Bold,
fontSize = 20.sp
)
Text(
modifier =
Modifier.padding(
start = 16.dp,
top = 8.dp,
end = 16.dp,
bottom = 16.dp
),
text =
gameDetails.publishersEntity.toPublishers()
)
}
}
fun Modifier.getDetailsModifier(): Modifier =
this.padding(start = 16.dp, top = 8.dp, end = 16.dp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment