Skip to content

Instantly share code, notes, and snippets.

View zurche's full-sized avatar
👋

Alejandro Zurcher zurche

👋
View GitHub Profile
@zurche
zurche / CryptoNavigation.kt
Created November 11, 2023 15:57
CryptoNavigation
@Composable
@Preview
fun CryptoNavigation(modifier: Modifier = Modifier) {
Row(
modifier = modifier
.height(55.dp)
.clip(RoundedCornerShape(50))
.background(color = Color.Black),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(5.dp)
@zurche
zurche / Refactor.kt
Created November 11, 2023 15:53
Refactor
@Composable
@Preview
fun CryptoNavigation(modifier: Modifier = Modifier) {
Row(
modifier = modifier
.height(50.dp)
.fillMaxWidth()
.clip(RoundedCornerShape(50))
.background(color = Color.Black)
) {
@zurche
zurche / NavButton.kt
Created November 11, 2023 15:49
onClick()
@Composable
private fun NavButton(icon: ImageVector, isSelected: Boolean = false, onClick: () -> Unit) { // <------- HERE
val backgroundColor = if (isSelected) LightOlive else CryptoDark800
val iconTint = if (isSelected) Color.Black else Color.White
Icon(
imageVector = icon,
contentDescription = "contentDescription",
modifier = Modifier
.size(48.dp)
.background(backgroundColor, CircleShape)
@zurche
zurche / PrivatePreview.kt
Created November 11, 2023 15:45
Preview trick
@Composable
@Preview
private fun NavButtonPreview() {
Row {
NavButton(icon = Icons.Filled.Check, isSelected = false)
NavButton(icon = Icons.Filled.Add, isSelected = true)
NavButton(icon = Icons.Filled.Build, isSelected = true)
}
}
@zurche
zurche / NavButton.kt
Created November 11, 2023 15:43
Final button
@Composable
private fun NavButton(icon: ImageVector, isSelected: Boolean = false) {
val backgroundColor = if (isSelected) LightOlive else CryptoDark800
val iconTint = if (isSelected) Color.Black else Color.White
Icon(
imageVector = icon,
contentDescription = "contentDescription",
modifier = Modifier
.size(48.dp)
.background(backgroundColor, CircleShape)
@zurche
zurche / NavButton.kt
Created November 11, 2023 15:41
Tint logic
val backgroundColor = if (isSelected) LightOlive else CryptoDark800
val iconTint = if (isSelected) Color.Black else Color.White
@zurche
zurche / NavButton.kt
Created November 11, 2023 15:39
Base boton
@Composable
private fun NavButton(icon: ImageVector, isSelected: Boolean = false) {
}
@zurche
zurche / CryptoNavigation.kt
Created November 11, 2023 15:29
Base structure of nav bar
@Composable
@Preview
fun CryptoNavigation(modifier: Modifier = Modifier) {
Card(
modifier = modifier
.height(50.dp)
.fillMaxWidth(),
shape = RoundedCornerShape(50),
colors = CardDefaults.cardColors(containerColor = Color.Black)
) {
@zurche
zurche / AssetPerformanceCardBase.kt
Created September 11, 2023 20:24
Asset Performance Card
@Composable
fun AssetPerformanceCard(
assetInfo: AssetInfo = mockAssetInfo
) {
Card(
modifier = Modifier
.wrapContentHeight()
.fillMaxWidth()
.padding(start = 5.dp, end = 5.dp, bottom = 5.dp),
colors = CardDefaults.cardColors(containerColor = CryptoWhite)
@zurche
zurche / AssetPerformanceCardFull.kt
Created September 11, 2023 20:05
Performance Card Final
private val mockAssetInfo = AssetInfo(
R.drawable.amd_icon,
"Advanced Micro Devices, Inc.",
"AMD",
listOf(
113.518f,
113.799f,
113.333f,
113.235f,
114.099f,