Skip to content

Instantly share code, notes, and snippets.

@Skyyo
Created Feb 19, 2021
Embed
What would you like to do?
@ExperimentalCoroutinesApi
@Composable
fun CardsScreen(viewModel: CardsScreenViewModel) {
val cards = viewModel.cards.collectAsState()
val revealedCardIds = viewModel.revealedCardIdsList.collectAsState()
Scaffold(backgroundColor = Color.White) {
LazyColumn {
itemsIndexed(cards.value) { _, card ->
Box(Modifier.fillMaxWidth()) {
ActionsRow(
actionIconSize = ACTION_ITEM_SIZE.dp,
onDelete = {},
onEdit = {},
onFavorite = {}
)
DraggableCard(
card = card,
isRevealed = revealedCardIds.value.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