Skip to content

Instantly share code, notes, and snippets.

@rubenquadros
Last active August 28, 2021 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenquadros/a2c021221a22511a884710182410e3a3 to your computer and use it in GitHub Desktop.
Save rubenquadros/a2c021221a22511a884710182410e3a3 to your computer and use it in GitHub Desktop.
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