Skip to content

Instantly share code, notes, and snippets.

@AlankritaShah
Created October 27, 2022 21:11
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/7c70a1ab0142308d71c79cc130bccc9d to your computer and use it in GitHub Desktop.
Save AlankritaShah/7c70a1ab0142308d71c79cc130bccc9d to your computer and use it in GitHub Desktop.
//Business Card
@Composable
fun BusinessCard() {
Column(modifier = Modifier.fillMaxSize()) {
BusinessCardTop(modifier = Modifier.weight(3F))
BusinessCardBottom(modifier = Modifier.weight(2F))
}
}
@Composable
fun BusinessCardTop(modifier: Modifier) {
val image = painterResource(id = R.drawable.ic_launcher_background)
Column(
modifier = modifier.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Bottom
) {
Image(
painter = image,
contentDescription = "All tasks done",
modifier = Modifier
.width(150.dp)
.height(150.dp)
)
Text(
text = "Alankrita",
fontSize = 24.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(0.dp, 24.dp, 0.dp, 8.dp)
)
Text(
text = "Hi From Alankrita",
fontSize = 16.sp
)
}
}
@Composable
fun BusinessCardBottom(modifier: Modifier) {
Column(
modifier = modifier
.fillMaxWidth()
.padding(0.dp, 0.dp, 0.dp, 50.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Bottom
) {
BusinessCardBottomRow("contact@gmail.com")
BusinessCardBottomRow("contact@gmail.com")
BusinessCardBottomRow("contact@gmail.com")
}
}
@Composable
fun BusinessCardBottomRow(contact: String) {
val image = painterResource(id = R.drawable.ic_launcher_background)
Row(
modifier = Modifier
.fillMaxWidth()
.padding(30.dp, 2.dp, 20.dp, 2.dp)
) {
Image(
painter = image,
contentDescription = contact,
modifier = Modifier
.width(30.dp)
.height(30.dp)
.padding(5.dp)
.wrapContentWidth(Alignment.Start)
)
Text(
contact,
modifier = Modifier
.padding(10.dp, 0.dp, 10.dp, 0.dp)
.align(Alignment.CenterVertically)
.fillMaxWidth()
.wrapContentWidth(Alignment.End)
)
}
}
@Preview(showBackground = true)
@Composable
fun BusinessCardPreview() {
ComposeExampleTheme {
BusinessCard()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment