Skip to content

Commit

Permalink
Fix animation speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Agarwal committed Nov 5, 2024
1 parent 9d3f087 commit 758cf56
Showing 1 changed file with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.simple.clinic.summary.compose

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.tween
import androidx.compose.animation.expandVertically
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -35,6 +38,11 @@ fun StatinNudge(
) {
AnimatedVisibility(
visible = isVisible,
enter = expandVertically(
animationSpec = tween(500),
expandFrom = Alignment.Top
),
exit = shrinkVertically(animationSpec = tween(500))
) {
Card(
modifier = modifier
Expand Down Expand Up @@ -100,22 +108,22 @@ fun RiskProgressBar() {
.fillMaxWidth()
.height(14.dp)
.drawWithContent {
drawContent()
drawContent()

val widthPerSegment = size.width / riskColors.size
val widthPerSegment = size.width / riskColors.size

drawLine(
color = indicatorColor,
start = Offset(2 * widthPerSegment, 0f),
end = Offset(2 * widthPerSegment, size.height),
strokeWidth = 2.dp.toPx()
)
drawLine(
color = indicatorColor,
start = Offset(size.width, 0f),
end = Offset(size.width, size.height),
strokeWidth = 2.dp.toPx()
)
drawLine(
color = indicatorColor,
start = Offset(2 * widthPerSegment, 0f),
end = Offset(2 * widthPerSegment, size.height),
strokeWidth = 2.dp.toPx()
)
drawLine(
color = indicatorColor,
start = Offset(size.width, 0f),
end = Offset(size.width, size.height),
strokeWidth = 2.dp.toPx()
)
},
contentAlignment = Alignment.Center,
) {
Expand Down

0 comments on commit 758cf56

Please sign in to comment.