Skip to content

Instantly share code, notes, and snippets.

@surajsau
Created December 7, 2020 15:21
Show Gist options
  • Save surajsau/18d432592176e42f88699237081e6fcd to your computer and use it in GitHub Desktop.
Save surajsau/18d432592176e42f88699237081e6fcd to your computer and use it in GitHub Desktop.
@Composable
fun ItemCard(
item: Item,
scrollX: Float,
modifier: Modifier = Modifier,
) {
Card(
modifier = modifier.size(width = 320.dp, height = 500.dp)
.padding(start = 16.dp, top = 16.dp, bottom = 16.dp),
) {
Column(modifier = Modifier.fillMaxWidth()) {
Image(
asset = imageResource(id = item.imageId),
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxWidth().fillMaxHeight(fraction = 0.8f),
// [1]
alignment = BiasAlignment((scrollX / 3000f), 0f)
)
Text(text = item.title,
..)
Text(text = item.subtitle,
..)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment