Skip to content

Instantly share code, notes, and snippets.

@Skyyo
Last active August 26, 2022 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Skyyo/5457b36f0cd997adf26923ff8bc340d4 to your computer and use it in GitHub Desktop.
Save Skyyo/5457b36f0cd997adf26923ff8bc340d4 to your computer and use it in GitHub Desktop.
@ExperimentalCoroutinesApi
@Composable
fun CardsScreen(viewModel: CardsScreenViewModel) {
val cards by viewModel.cards.collectAsStateWithLifecycle()
val revealedCardIds by viewModel.revealedCardIdsList.collectAsStateWithLifecycle()
Scaffold {
LazyColumn {
items(cards.value, CardModel::id) { card ->
Box(Modifier.fillMaxWidth()) {
ActionsRow(
actionIconSize = ACTION_ITEM_SIZE.dp,
onDelete = {},
onEdit = {},
onFavorite = {}
)
DraggableCard(
card = card,
isRevealed = revealedCardIds.contains(card.id),
cardHeight = CARD_HEIGHT.dp,
cardOffset = CARD_OFFSET.dp(),
onExpand = { viewModel.onItemExpanded(card.id) },
onCollapse = { viewModel.onItemCollapsed(card.id) },
)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment