This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun Cards.State.toProps() = | |
when (this) { | |
is Queued -> queued | |
is Bottom -> bottom | |
is Top -> top | |
is VoteLike -> voteLike | |
is VotePass -> votePass | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CardsTransitionHandler<T>( | |
private val transitionSpec: TransitionSpec<Cards.State, Float> = { | |
spring(stiffness = Spring.StiffnessVeryLow) | |
} | |
) : ModifierTransitionHandler<T, Cards.State>() { | |
private fun Cards.State.toProps() = | |
when (this) { | |
is Queued -> queued | |
is Bottom -> bottom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lifecycle.coroutineScope.launchWhenStarted { | |
delay(1000) | |
repeat(3) { | |
delay(2000) | |
cards.indicateLike() | |
delay(1000) | |
cards.indicatePass() | |
delay(1000) | |
cards.votePass() | |
delay(1000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val cards = Cards( | |
initialItems = listOf( | |
Routing.ProfileCard(0, "Lara"), // Will be top | |
Routing.ProfileCard(1, "Kate"), // Will be bottom | |
Routing.ProfileCard(2, "Brad"), // Queued = 0 | |
Routing.ProfileCard(3, "Megan"), // ...etc. | |
Routing.ProfileCard(4, "Michael"), | |
Routing.ProfileCard(0, "Lara"), | |
Routing.ProfileCard(1, "Kate"), | |
Routing.ProfileCard(2, "Brad"), |
OlderNewer