Modern Apps git

← Modern-Apps.git

fooddelivery: tip picker chips back to a scrollable Row

Commit
2f71d0bc4800db07b327426b14237a30aa3464b9
Author
Vayun Mathur <[email protected]>
When
2026-11-19 22:44 UTC (16 days ago)
Parents
7c609e5
Reverts the FlowRow from fc781394b for this one picker: under a
bounded-height parent (a 446dp test window, or any short non-
scrolling sheet) FlowRow measures but leaves later chips
unplaced at 0x0, so / had no bounds to tap - checkoutPickers
Interact reproduced it (expected tip 500, was -1). In production
the picker sits in an unbounded LazyColumn so it appeared fine.

Four fixed short chips don't need wrapping; a horizontally
scrollable Row keeps every chip reachable at large font scales,
which was the original census concern, without FlowRow's
unplaced-chip failure. No test changed.

Verified: :fooddelivery:testDevUnitTest 160/160 (failure
reproduced before, passes after).

Diff

fooddelivery/src/main/java/com/vayunmathur/fooddelivery/ui/CheckoutSections.kt
diff --git a/fooddelivery/src/main/java/com/vayunmathur/fooddelivery/ui/CheckoutSections.kt b/fooddelivery/src/main/java/com/vayunmathur/fooddelivery/ui/CheckoutSections.ktindex 9829a6cc58..c3ac0a5e1d 100644--- a/fooddelivery/src/main/java/com/vayunmathur/fooddelivery/ui/CheckoutSections.kt+++ b/fooddelivery/src/main/java/com/vayunmathur/fooddelivery/ui/CheckoutSections.kt@@ -1,9 +1,9 @@ package com.vayunmathur.fooddelivery.ui +import androidx.compose.foundation.horizontalScroll+import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column-import androidx.compose.foundation.layout.ExperimentalLayoutApi-import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth@@ -195,7 +195,6 @@ internal fun CheckoutAddressPicker(     ) } -@OptIn(ExperimentalLayoutApi::class) @Composable internal fun CheckoutTipPicker(     tipCents: Int,@@ -212,7 +211,15 @@ internal fun CheckoutTipPicker(     )     Spacer(Modifier.height(8.dp)) -    FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {+    // Only four fixed chips: a scrollable Row, not FlowRow. FlowRow leaves+    // chips unplaced (0x0, unclickable) when a bounded-height parent (e.g. a+    // non-scrolling Column) gives it no remaining height; a Row still places+    // them, and scrolling keeps every chip reachable at large font scales+    // instead of running off-screen.+    Row(+        modifier = Modifier.horizontalScroll(rememberScrollState()),+        horizontalArrangement = Arrangement.spacedBy(8.dp)+    ) {         listOf(0, 200, 300, 500).forEach { cents ->             val label = if (cents == 0) "None" else "$%.2f".format(cents / 100.0)             FilterChip(