0afcf4f6c6b4

fix both Gate 1 findings from the 2026-07-23 material-3 audit of the six shared primitives: bump PeachSegmentedControl's touch target from 34dp to MD3's 48dp minimum; route PeachTopBar/PeachField/PeachExpandableCard/PeachSegmentedControl through MaterialTheme.colorScheme for every role PeachTheme already maps 1:1 to the same peachColors value (surface, onSurface, surfaceVariant, outline, onPrimary), leaving genuinely custom tones (T1/T2/T4, SurfaceElevated) on peachColors since MD3 has no equivalent role for them

time
2026-07-24 17:18 UTC · 3 months ago
machine
koh2
agent
claude-sonnet-5
session
fix Gate 1 primitive findings
parent
aa9cb4d3508c
4 files app/src/main/java/com/peachpasswords/ui/components/PeachExpandableCard.kt+3 −1app/src/main/java/com/peachpasswords/ui/components/PeachField.kt+5 −2app/src/main/java/com/peachpasswords/ui/components/PeachSegmentedControl.kt+9 −4app/src/main/java/com/peachpasswords/ui/components/PeachTopBar.kt+7 −4
app/src/main/java/com/peachpasswords/ui/components/PeachExpandableCard.kt+3 −1
@@ -12,6 +12,7 @@1212 import androidx.compose.foundation.layout.height1313 import androidx.compose.foundation.layout.padding1414 import androidx.compose.foundation.shape.RoundedCornerShape15+import androidx.compose.material3.MaterialTheme1516 import androidx.compose.material3.Surface1617 import androidx.compose.runtime.Composable1718 import androidx.compose.runtime.getValue@@ -55,7 +56,8 @@5556             .height(animatedHeight)5657             .scrollable(scrollState, orientation = Orientation.Vertical),5758         color = peachColors.SurfaceElevated,58-        contentColor = peachColors.T0,59+        // Gate 1: colorScheme.onSurface is PeachTheme's exact mapping of T0.60+        contentColor = MaterialTheme.colorScheme.onSurface,5961         shape = RoundedCornerShape(18.dp),6062         tonalElevation = 1.dp,6163     ) {

view file

app/src/main/java/com/peachpasswords/ui/components/PeachField.kt+5 −2
@@ -10,6 +10,7 @@1010 import androidx.compose.foundation.layout.width1111 import androidx.compose.foundation.text.BasicTextField1212 import androidx.compose.foundation.text.KeyboardOptions13+import androidx.compose.material3.MaterialTheme1314 import androidx.compose.material3.Text1415 import androidx.compose.runtime.Composable1516 import androidx.compose.runtime.getValue@@ -46,7 +47,9 @@4647     val accent = LocalPeachAccent.current4748     val interaction = remember { MutableInteractionSource() }4849     val focused by interaction.collectIsFocusedAsState()49-    val hairline = peachColors.T350+    // Gate 1: colorScheme.outline is PeachTheme's exact mapping of T3 — route51+    // through it here so this primitive doesn't bypass the theme.52+    val hairline = MaterialTheme.colorScheme.outline5053 5154     Column(modifier.fillMaxWidth()) {5255         Text(@@ -62,7 +65,7 @@6265                 onValueChange = onValueChange,6366                 singleLine = singleLine,6467                 textStyle = TextStyle(65-                    color = peachColors.T0,68+                    color = MaterialTheme.colorScheme.onSurface,6669                     fontFamily = if (mono) PeachType.Mono else PeachType.Body,6770                     fontSize = 13.sp,6871                 ),

view file

app/src/main/java/com/peachpasswords/ui/components/PeachSegmentedControl.kt+9 −4
@@ -10,6 +10,7 @@1010 import androidx.compose.foundation.layout.fillMaxWidth1111 import androidx.compose.foundation.layout.padding1212 import androidx.compose.foundation.shape.RoundedCornerShape13+import androidx.compose.material3.MaterialTheme1314 import androidx.compose.material3.Surface1415 import androidx.compose.material3.Text1516 import androidx.compose.runtime.Composable@@ -39,7 +40,8 @@3940     val accent = LocalPeachAccent.current4041     Surface(4142         modifier = modifier.fillMaxWidth(),42-        color = peachColors.S1,43+        // Gate 1: colorScheme.surface is PeachTheme's exact mapping of S1.44+        color = MaterialTheme.colorScheme.surface,4345         shape = RoundedCornerShape(999.dp),4446         tonalElevation = 1.dp,4547     ) {@@ -53,10 +55,13 @@5355                 Surface(5456                     modifier = Modifier5557                         .weight(1f)56-                        .defaultMinSize(minHeight = 34.dp)58+                        // MD3 minimum touch target (Gate 1 finding).59+                        .defaultMinSize(minHeight = 48.dp)5760                         .clickable { onSelected(segment.key) },58-                    color = if (selected) accent else peachColors.S2,59-                    contentColor = if (selected) peachColors.Bg else peachColors.T1,61+                    // Gate 1: colorScheme.surfaceVariant/onPrimary are PeachTheme's62+                    // exact mappings of S2/Bg.63+                    color = if (selected) accent else MaterialTheme.colorScheme.surfaceVariant,64+                    contentColor = if (selected) MaterialTheme.colorScheme.onPrimary else peachColors.T1,6065                     shape = RoundedCornerShape(999.dp),6166                 ) {6267                     Row(

view file

app/src/main/java/com/peachpasswords/ui/components/PeachTopBar.kt+7 −4
@@ -9,6 +9,7 @@99 import androidx.compose.foundation.layout.padding1010 import androidx.compose.foundation.layout.widthIn1111 import androidx.compose.foundation.shape.RoundedCornerShape12+import androidx.compose.material3.MaterialTheme1213 import androidx.compose.material3.Surface1314 import androidx.compose.material3.Text1415 import androidx.compose.runtime.Composable@@ -18,7 +19,6 @@1819 import androidx.compose.ui.unit.dp1920 import com.peachpasswords.ui.theme.PeachSpacing2021 import com.peachpasswords.ui.theme.PeachType21-import com.peachpasswords.ui.theme.peachColors2222 2323 @Composable2424 fun PeachTopBar(@@ -29,8 +29,11 @@2929 ) {3030     Surface(3131         modifier = modifier.fillMaxWidth(),32-        color = peachColors.S1,33-        contentColor = peachColors.T0,32+        // Gate 1: route through colorScheme for the roles PeachTheme already33+        // maps 1:1 to these exact peachColors values (surface/onSurface), so34+        // this primitive doesn't silently bypass the theme.35+        color = MaterialTheme.colorScheme.surface,36+        contentColor = MaterialTheme.colorScheme.onSurface,3437         shape = RoundedCornerShape(18.dp),3538         tonalElevation = 1.dp,3639     ) {@@ -46,7 +49,7 @@4649             }4750             Text(4851                 text = title,49-                color = peachColors.T0,52+                color = MaterialTheme.colorScheme.onSurface,5053                 style = PeachType.wordmark,5154                 maxLines = 1,5255                 overflow = TextOverflow.Ellipsis,

view file