calculator: expand the unit converter form when it fills
- Commit
8baa122197e6671c4fbe476034108832964d91b8- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-05 16:25 UTC (21 hours ago)
- Parents
1bb6514
The converter form mounted in a cut once a category (or the live currency units) existed. It now comes up through ExpandVisibility in the scroll column. CurrencyStatus stays outside the animation: loading/error is shown instantly, 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
calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterScreen.kt
diff --git a/calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterScreen.kt b/calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterScreen.ktindex 80a9b02ee4..5c9e9a7640 100644--- a/calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterScreen.kt+++ b/calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterScreen.kt@@ -24,6 +24,7 @@ import com.vayunmathur.library.ui.AppBarAlignment import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Card import com.vayunmathur.library.ui.DesktopMaxWidthContainer+import com.vayunmathur.library.ui.ExpandVisibility import com.vayunmathur.library.ui.FilledTonalIconButton import com.vayunmathur.library.ui.IconSwapLanguages import com.vayunmathur.library.ui.MaterialTheme@@ -60,14 +61,18 @@ fun UnitConverterScreen( onSelect = actions::selectCategory, modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.lg, vertical = Spacing.xs), )- if (category != null) {- if (state.isCurrencyCategory && category.units.isEmpty()) {- CurrencyStatus(- loading = state.currencyLoading,- error = state.currencyError,- onRetry = actions::retryCurrency,- )- } else {+ if (category != null && state.isCurrencyCategory && category.units.isEmpty()) {+ CurrencyStatus(+ loading = state.currencyLoading,+ error = state.currencyError,+ onRetry = actions::retryCurrency,+ )+ }+ ExpandVisibility(+ visible = category != null &&+ !(state.isCurrencyCategory && category.units.isEmpty()),+ ) {+ if (category != null) { Column( Modifier.fillMaxWidth().padding(Spacing.lg), verticalArrangement = Arrangement.spacedBy(Spacing.md),