flashcards: expand stats sections when their data fills
- Commit
6864a372c95b9e86a895c73cc7c86e8f66705458- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-05 16:25 UTC (11 hours ago)
- Parents
43f7c2c
The deck filter-chip row, forecast chart and retention chart mounted in a cut once their data was non-empty. All three now open through ExpandVisibility in the scrolling stats column. The empty-reviews state stays instant, as before. Wrap abrupt conditional content in the shared library.ui motion helpers so it expands/fades/pops in instead of popping in cut, and closes up cleanly when it goes away. No raw androidx.compose. animation is used at the call site, per the fatal DirectCompose Animation lint; durations and easing come from the helpers' MaterialTheme motion-scheme defaults. Verified in this worktree with lint, lintVitalRelease and testDevUnitTest for the module (details in the session report; any pre-existing failure was reproduced on the pristine base).
Diff
flashcards/src/main/java/com/vayunmathur/flashcards/ui/StatsScreen.kt
diff --git a/flashcards/src/main/java/com/vayunmathur/flashcards/ui/StatsScreen.kt b/flashcards/src/main/java/com/vayunmathur/flashcards/ui/StatsScreen.ktindex dd3bd75db9..37ddb85356 100644--- a/flashcards/src/main/java/com/vayunmathur/flashcards/ui/StatsScreen.kt+++ b/flashcards/src/main/java/com/vayunmathur/flashcards/ui/StatsScreen.kt@@ -34,6 +34,7 @@ import com.vayunmathur.flashcards.ui.StatsUiState import com.vayunmathur.library.ui.EmptyState import com.vayunmathur.library.ui.FilterChip import com.vayunmathur.library.ui.AppScaffold+import com.vayunmathur.library.ui.ExpandVisibility import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.SecondaryTabRow import com.vayunmathur.library.ui.Tab@@ -61,7 +62,7 @@ fun StatsScreen(state: StatsUiState, actions: StatsActions) { .padding(paddingValues) .verticalScroll(rememberScrollState()), ) {- if (state.deckOptions.size > 1) {+ ExpandVisibility(visible = state.deckOptions.size > 1) { Row( Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(horizontal = 12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp),@@ -104,7 +105,7 @@ fun StatsScreen(state: StatsUiState, actions: StatsActions) { ) } - if (state.forecast.any { it.count > 0 }) {+ ExpandVisibility(visible = state.forecast.any { it.count > 0 }) { ChartSection(stringResource(R.string.stat_forecast)) { ReviewBarChart( data = state.forecast.map {@@ -115,7 +116,7 @@ fun StatsScreen(state: StatsUiState, actions: StatsActions) { } } - if (state.retentionBuckets.any { it.second > 0f }) {+ ExpandVisibility(visible = state.retentionBuckets.any { it.second > 0f }) { ChartSection(stringResource(R.string.stat_retention_by_interval)) { ReviewBarChart( data = state.retentionBuckets.map { it.first to (it.second * 100).toDouble() },