Skip to content

Instantly share code, notes, and snippets.

@devDeejay
Created October 2, 2021 19:42
Show Gist options
  • Save devDeejay/0f20963e4e4cef59e218cda3232889e7 to your computer and use it in GitHub Desktop.
Save devDeejay/0f20963e4e4cef59e218cda3232889e7 to your computer and use it in GitHub Desktop.
@Composable
private fun ChatCard(title: String, body: String) {
Surface(
shape = MaterialTheme.shapes.medium,
elevation = 8.dp,
modifier = Modifier.padding(all = 8.dp)
) {
Row(modifier = Modifier.padding(all = 8.dp)) {
Image(
painter = painterResource(
id = R.drawable.ic_launcher_background
), contentDescription = "Some cool image",
// Image Modifier
modifier = Modifier
// Set image size to 40 dp
.size(48.dp)
// Clip image to be shaped as a circle
.clip(CircleShape)
.border(1.dp, MaterialTheme.colors.secondary, CircleShape)
)
Spacer(modifier = Modifier.width(8.dp))
Column {
Text(text = title, style = MaterialTheme.typography.subtitle2)
// Adding a vertical space
Spacer(modifier = Modifier.height(4.dp))
Text(
text = body,
color = MaterialTheme.colors.secondaryVariant,
style = MaterialTheme.typography.body2
)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment