Skip to content

Instantly share code, notes, and snippets.

@AlankritaShah
Created October 27, 2022 21:01
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 AlankritaShah/7acfd9af67f44b39a1226e63418b1d4e to your computer and use it in GitHub Desktop.
Save AlankritaShah/7acfd9af67f44b39a1226e63418b1d4e to your computer and use it in GitHub Desktop.
@Composable
fun ComposeArticle(head: String, body1: String, body2: String, image: Int) {
val image = painterResource(id = image)
Column(modifier = Modifier.fillMaxSize()) {
Image(
painter = image,
contentDescription = "Jetpack Compose Article",
modifier = Modifier
.fillMaxWidth()
.height(200.dp),
contentScale = ContentScale.Crop
)
Text(
text = head,
fontSize = 24.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(16.dp, 16.dp, 16.dp, 8.dp)
)
Text(
text = body1,
textAlign = TextAlign.Justify,
modifier = Modifier.padding(16.dp, 8.dp, 16.dp, 8.dp)
)
Text(
text = body2,
textAlign = TextAlign.Justify,
modifier = Modifier.padding(16.dp, 8.dp, 16.dp, 16.dp)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment