Skip to content

Commit

Permalink
Update compose animation according to new UI code
Browse files Browse the repository at this point in the history
  • Loading branch information
raseln committed Sep 6, 2024
1 parent f9e609f commit 14300ef
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand Down

0 comments on commit 14300ef

Please sign in to comment.