Skip to content

Commit

Permalink
[REFACTOR] #125 : 설문 응답 ProgressBar Animation으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 16, 2024
1 parent fe230b9 commit d09185a
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.wap.wapp.feature.survey.answer

import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.spring
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand All @@ -10,6 +13,7 @@ import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.StrokeCap
Expand Down Expand Up @@ -49,10 +53,18 @@ private fun SurveyAnswerStateText(index: Int, size: Int) {

@Composable
private fun SurveyAnswerStateProgressBar(index: Int, size: Int) {
val progress by animateFloatAsState(
targetValue = index.toFloat() / size.toFloat(),
animationSpec = spring(
stiffness = Spring.StiffnessMediumLow,
dampingRatio = Spring.DampingRatioMediumBouncy,
),
)

LinearProgressIndicator(
color = WappTheme.colors.yellow34,
trackColor = WappTheme.colors.white,
progress = index.toFloat() / size.toFloat(),
progress = progress,
strokeCap = StrokeCap.Round,
modifier = Modifier
.fillMaxWidth()
Expand Down

0 comments on commit d09185a

Please sign in to comment.