diff --git a/feature/question/src/main/kotlin/com/eblan/socialworkreviewer/feature/question/screen/QuestionScreen.kt b/feature/question/src/main/kotlin/com/eblan/socialworkreviewer/feature/question/screen/QuestionScreen.kt index 5b09c20..9b8b9ac 100644 --- a/feature/question/src/main/kotlin/com/eblan/socialworkreviewer/feature/question/screen/QuestionScreen.kt +++ b/feature/question/src/main/kotlin/com/eblan/socialworkreviewer/feature/question/screen/QuestionScreen.kt @@ -366,7 +366,15 @@ private fun QuestionScreenTopBar( Spacer(modifier = Modifier.width(5.dp)) - Text(text = "$questionsWithSelectedChoicesSize", fontWeight = FontWeight.Bold) + AnimatedContent( + targetState = questionsWithSelectedChoicesSize, + transitionSpec = { + slideInVertically { it } togetherWith slideOutVertically { -it } + }, + label = "", + ) { state -> + Text(text = "$state", fontWeight = FontWeight.Bold) + } if (countDownTime != null && countDownTime.isFinished.not()) { Spacer(modifier = Modifier.width(20.dp)) @@ -375,7 +383,7 @@ private fun QuestionScreenTopBar( Spacer(modifier = Modifier.width(5.dp)) - Text(text = countDownTime.minutes, fontWeight = FontWeight.Bold) + AnimatedCountDownTimerText(text = countDownTime.minutes, fontWeight = FontWeight.Bold) } } } @@ -522,6 +530,31 @@ private fun QuestionChoicesSelection( } } +@Composable +private fun AnimatedCountDownTimerText( + modifier: Modifier = Modifier, + text: String, + fontWeight: FontWeight? = null, +) { + Row { + text.indices.forEach { i -> + AnimatedContent( + targetState = text[i], + transitionSpec = { + slideInVertically { it } togetherWith slideOutVertically { -it } + }, + label = "", + ) { char -> + Text( + text = "$char", + modifier = modifier, + fontWeight = fontWeight, + ) + } + } + } +} + @Composable private fun EmptyState( modifier: Modifier = Modifier,