Skip to content

Instantly share code, notes, and snippets.

@enginebai
Created January 9, 2022 10:07
Show Gist options
  • Save enginebai/b16e3b417b2dc8d05a9596f78200c597 to your computer and use it in GitHub Desktop.
Save enginebai/b16e3b417b2dc8d05a9596f78200c597 to your computer and use it in GitHub Desktop.
@Composable
fun MovieInfoWidget(
posterUrl: String? = null,
movieName: String? = null,
isBookmark: Boolean = false,
rating: Float = 0.0f,
ratingTotalCountText: String? = null,
genres: String? = null,
releaseDateText: String? = null,
runtimeText: String? = null,
overview: String? = null,
onBackButtonClicked: () -> Unit = {}
) {
Column {
Image(
painter = rememberImagePainter(data = posterUrl),
contentDescription = null,
modifier = Modifier
.fillMaxWidth()
.aspectRatio(ratio = 3.0f.div(4.0f)),
contentScale = ContentScale.Crop
)
Text(
movieName ?: "",
style = MHStyle.headline5,
)
MovieRatingWidget(
rating = rating,
textRating = stringResource(
R.string.reviews_total_count,
ratingTotalCountText ?: ""
)
)
Text(
genres ?: "",
style = MHStyle.caption.copy(color = ColorsPalette.grey),
modifier = Modifier.padding(top = 8.dp)
)
Text(
releaseDateText ?: "",
style = MHStyle.caption.copy(color = ColorsPalette.grey),
modifier = Modifier.padding(top = 8.dp)
)
Text(
runtimeText ?: ",",
style = MHStyle.caption.copy(color = ColorsPalette.colorAccent),
)
if (!overview.isNullOrBlank()) {
Spacer(modifier = Modifier.height(20.dp))
Text(stringResource(id = R.string.title_overview), style = MHStyle.headline6)
Spacer(modifier = Modifier.height(4.dp))
Text(
overview, style = MHStyle.body2,
modifier = Modifier.padding(vertical = 8.dp)
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment