Skip to content

Instantly share code, notes, and snippets.

@raulh82vlc
Last active March 29, 2021 19:42
Show Gist options
  • Save raulh82vlc/76183f53547cdece1c5275008faf62b4 to your computer and use it in GitHub Desktop.
Save raulh82vlc/76183f53547cdece1c5275008faf62b4 to your computer and use it in GitHub Desktop.
SimpleTweetBox example
@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