diff --git a/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/component/ContributorsCountItem.kt b/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/component/ContributorsCountItem.kt index 1d4130119..33f41b2d6 100644 --- a/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/component/ContributorsCountItem.kt +++ b/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/component/ContributorsCountItem.kt @@ -13,12 +13,15 @@ import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import conference_app_2024.feature.contributors.generated.resources.contributor_person -import conference_app_2024.feature.contributors.generated.resources.contributor_title import conference_app_2024.feature.contributors.generated.resources.contributor_total import io.github.droidkaigi.confsched.contributors.ContributorsRes import org.jetbrains.compose.resources.stringResource @@ -28,14 +31,18 @@ internal fun ContributorsCountItem( totalContributor: Int, modifier: Modifier = Modifier, ) { + var targetValue by remember { mutableStateOf(0) } val animatedTotalContributor by animateIntAsState( - targetValue = totalContributor, + targetValue = targetValue, animationSpec = tween( delayMillis = 300, durationMillis = 1000, easing = EaseOutQuart, ), ) + LaunchedEffect(totalContributor) { + targetValue = totalContributor + } Column( modifier = modifier .padding(horizontal = 16.dp, vertical = 10.dp),