Skip to content

Instantly share code, notes, and snippets.

@zurche
Created June 21, 2023 20:10
Show Gist options
  • Save zurche/abc79a90c93753bcda4271622b62691f to your computer and use it in GitHub Desktop.
Save zurche/abc79a90c93753bcda4271622b62691f to your computer and use it in GitHub Desktop.
CryptoCard result
/**
* A composable function that represents a crypto card.
*
* @param style The style of the crypto card. Default is [CryptoCardStyle.Dark].
* @param data The [CryptoCardData] data for the crypto card.
*/
@Composable
fun CryptoCard(
style: CryptoCardStyle = CryptoCardStyle.Dark,
data: CryptoCardData = CryptoCardData(
name = "Bitcoin",
icon = R.drawable.ic_btc,
value = 3.689087f,
valueChange = -18,
currentTotal = 98160
)
) {
val cardBackground: Color = when (style) {
CryptoCardStyle.Dark -> Color(0xFF000000)
CryptoCardStyle.Light -> Color(0xFFadc9ae)
}
val textColor: Color = when (style) {
CryptoCardStyle.Dark -> Color(0xFFFFFFFF)
CryptoCardStyle.Light -> Color(0xFF000000)
}
Box {
CryptoCardBackground(cardBackground)
CryptoCardContent(data, textColor)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment