From a5d3918522667de88c35a9260c1660c6d67e3015 Mon Sep 17 00:00:00 2001 From: Nishant Mishra Date: Thu, 4 Dec 2025 11:04:34 +0530 Subject: [PATCH] feat(graphs): add chart animation for when a value changes --- .../java/org/nsh07/pomodoro/ui/statsScreen/TimeColumnChart.kt | 4 +++- .../java/org/nsh07/pomodoro/ui/statsScreen/TimeLineChart.kt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/TimeColumnChart.kt b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/TimeColumnChart.kt index ced5ff4..f38b4b1 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/TimeColumnChart.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/TimeColumnChart.kt @@ -22,6 +22,7 @@ import androidx.compose.animation.core.AnimationSpec import androidx.compose.foundation.layout.height import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.MaterialTheme.colorScheme +import androidx.compose.material3.MaterialTheme.motionScheme import androidx.compose.material3.MaterialTheme.typography import androidx.compose.material3.Surface import androidx.compose.runtime.Composable @@ -96,7 +97,7 @@ fun TimeColumnChart( millisecondsToMinutes(value, minutesFormat) } }, - animationSpec: AnimationSpec? = null + animationSpec: AnimationSpec? = motionScheme.defaultEffectsSpec() ) { ProvideVicoTheme(rememberM3VicoTheme()) { CartesianChartHost( @@ -160,6 +161,7 @@ fun TimeColumnChart( minZoom = Zoom.min(Zoom.Content, Zoom.fixed()) ), animationSpec = animationSpec, + animateIn = false, modifier = modifier.height(226.dp), ) } diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/TimeLineChart.kt b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/TimeLineChart.kt index 5083b14..2ee1bed 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/TimeLineChart.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/TimeLineChart.kt @@ -22,6 +22,7 @@ import androidx.compose.animation.core.AnimationSpec import androidx.compose.foundation.layout.height import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.MaterialTheme.colorScheme +import androidx.compose.material3.MaterialTheme.motionScheme import androidx.compose.material3.MaterialTheme.typography import androidx.compose.material3.Surface import androidx.compose.runtime.Composable @@ -102,7 +103,7 @@ fun TimeLineChart( millisecondsToMinutes(value, minutesFormat) } }, - animationSpec: AnimationSpec? = null + animationSpec: AnimationSpec? = motionScheme.defaultEffectsSpec() ) { ProvideVicoTheme(rememberM3VicoTheme()) { CartesianChartHost( @@ -183,6 +184,7 @@ fun TimeLineChart( minZoom = Zoom.min(Zoom.Content, Zoom.fixed()) ), animationSpec = animationSpec, + animateIn = false, modifier = modifier.height(224.dp), ) }