Skip to content

Instantly share code, notes, and snippets.

@catalinghita8
Last active July 7, 2021 13:55
Show Gist options
  • Save catalinghita8/a7c41968ab7830fbcb78b52a22d6f7e4 to your computer and use it in GitHub Desktop.
Save catalinghita8/a7c41968ab7830fbcb78b52a22d6f7e4 to your computer and use it in GitHub Desktop.
@Composable
private fun CategoryDetailsCollapsingToolbar(category: FoodItem?, scrollOffset: Float) {
val imageSize by animateDpAsState(targetValue = max(72.dp, 128.dp * scrollOffset))
val linesCount = max(3f, scrollOffset * 6).toInt()
Row {
Image(modifier = Modifier.size(imageSize), ...)
Column {
Text(text = item?.name)
Text(
text = item.description.trim(),
maxLines = linesCount
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment