Modern Apps git

← Modern-Apps.git

health: crossfade the picker field clear/chevron trailing icon

Commit
28df82fe05f17cd8fe633aa954946ab129f83ba9
Author
Vayun Mathur <[email protected]>
When
2026-12-05 16:25 UTC (22 hours ago)
Parents
dc28f97
PickerField swapped its trailing clear button and chevron in a
cut when a value was set or cleared. SwappedContent now
dissolves between them in the same trailing slot.

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

health/src/main/java/com/vayunmathur/health/ui/components/PickerField.kt
diff --git a/health/src/main/java/com/vayunmathur/health/ui/components/PickerField.kt b/health/src/main/java/com/vayunmathur/health/ui/components/PickerField.ktindex d4b8faa5e7..4ed62a053e 100644--- a/health/src/main/java/com/vayunmathur/health/ui/components/PickerField.kt+++ b/health/src/main/java/com/vayunmathur/health/ui/components/PickerField.kt@@ -10,6 +10,7 @@ import com.vayunmathur.library.ui.IconClose import com.vayunmathur.library.ui.ListItem import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedCard+import com.vayunmathur.library.ui.SwappedContent import com.vayunmathur.library.ui.Text  /**@@ -44,10 +45,12 @@ fun PickerField(                 }             },             trailingContent = {-                if (enabled && onClear != null && value.isNotBlank()) {-                    IconButton(onClick = onClear) { IconClose() }-                } else {-                    IconChevronRight()+                SwappedContent(state = enabled && onClear != null && value.isNotBlank()) { showClear ->+                    if (showClear) {+                        IconButton(onClick = onClear!!) { IconClose() }+                    } else {+                        IconChevronRight()+                    }                 }             },         )