Last active
March 29, 2021 19:42
-
-
Save raulh82vlc/76183f53547cdece1c5275008faf62b4 to your computer and use it in GitHub Desktop.
SimpleTweetBox example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun SimpleTweetBox( | |
tweet: Tweet, | |
onClick: () -> Unit | |
) { | |
Box( | |
modifier = Modifier | |
.border( | |
width = 1.dp, | |
color = Color.LightGray, | |
shape = RoundedCornerShape(16.dp) | |
) | |
.fillMaxWidth() | |
.clickable(onClick = onClick) | |
.padding(6.dp), | |
) { | |
val user = tweet.user ?: "" | |
val imageUrl: String = tweet.images[0] | |
Column( | |
modifier = Modifier.fillMaxWidth().padding(10.dp), | |
verticalArrangement = Arrangement.SpaceBetween, | |
horizontalAlignment = Alignment.CenterHorizontally, | |
) { | |
CoilImage( | |
data = imageUrl, | |
contentDescription = "$user image thumbnail", | |
modifier = Modifier.size(60.dp) | |
) | |
Spacer(modifier = Modifier.height(10.dp)) | |
Text(text = user, | |
style = TextStyle(color = Color.Blue), | |
textAlign = TextAlign.Center, | |
maxLines = 1 | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment