Skip to content

Commit 281f0cf

Browse files
authored
Merge pull request #148 from code-payments/chore/badge-animation
chore(badge): fade{In/Out} + scale{In/Out} instead of default animation
2 parents 8af9131 + 24c3d22 commit 281f0cf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • app/src/main/java/com/getcode/ui/components

app/src/main/java/com/getcode/ui/components/Badge.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package com.getcode.ui.components
22

33
import androidx.compose.animation.AnimatedVisibility
4+
import androidx.compose.animation.fadeIn
5+
import androidx.compose.animation.fadeOut
6+
import androidx.compose.animation.scaleIn
7+
import androidx.compose.animation.scaleOut
48
import androidx.compose.material.Text
59
import androidx.compose.runtime.Composable
610
import androidx.compose.ui.Modifier
@@ -17,7 +21,7 @@ fun Badge(
1721
color: Color = CodeTheme.colors.brand,
1822
contentColor: Color = Color.White,
1923
) {
20-
AnimatedVisibility(visible = count > 0) {
24+
AnimatedVisibility(visible = count > 0, enter = scaleIn() + fadeIn(), exit = fadeOut() + scaleOut()) {
2125
val text = when {
2226
count in 1..99 -> "$count"
2327
else -> "99+"

0 commit comments

Comments
 (0)