Created
June 21, 2023 20:10
-
-
Save zurche/abc79a90c93753bcda4271622b62691f to your computer and use it in GitHub Desktop.
CryptoCard result
This file contains 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
/** | |
* 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