feat(components): let a tinted grouped row name its content colour

GroupedRow's container had no `on*` pair, so a row given a tint kept its
text on onSurface — readable by luck rather than by the theme. Wanted by a
status row that colours itself by outcome.
This commit is contained in:
2026-09-09 13:48:17 +02:00
parent 3dc3448265
commit 692c0a84c4
@@ -127,9 +127,12 @@ fun GroupedSurface(
* headline and summary to the M3 disabled emphasis while leaving the [trailing]
* control at full opacity — for rows that are present but switched off.
* [container] overrides the row's tonal colour (e.g. a category tint); ignored
* when [selected]. [gapBelow] (see [GroupedSurface]) suppresses the inter-row
* gap for a caller that owns its own uniform spacing, e.g. [ReorderableColumn].
* [onLongClick] (see [GroupedSurface]) adds a long-press to the row.
* when [selected]. [contentColor] is its pair — the `on*` role for that
* container, so a tinted row keeps its contrast in both themes instead of
* leaving the text on `onSurface`. [gapBelow] (see [GroupedSurface]) suppresses
* the inter-row gap for a caller that owns its own uniform spacing, e.g.
* [ReorderableColumn]. [onLongClick] (see [GroupedSurface]) adds a long-press to
* the row.
*/
@Composable
fun GroupedRow(
@@ -140,6 +143,7 @@ fun GroupedRow(
selected: Boolean = false,
dimmed: Boolean = false,
container: Color? = null,
contentColor: Color? = null,
minHeight: Dp = 72.dp,
gapBelow: Boolean = true,
leading: @Composable (() -> Unit)? = null,
@@ -154,6 +158,7 @@ fun GroupedRow(
selected = selected,
dimmed = dimmed,
container = container,
contentColor = contentColor,
minHeight = minHeight,
gapBelow = gapBelow,
leading = leading,
@@ -177,6 +182,7 @@ fun GroupedRow(
selected: Boolean = false,
dimmed: Boolean = false,
container: Color? = null,
contentColor: Color? = null,
minHeight: Dp = 72.dp,
gapBelow: Boolean = true,
leading: @Composable (() -> Unit)? = null,
@@ -202,6 +208,14 @@ fun GroupedRow(
leadingIconColor = muted,
supportingColor = muted,
)
} else if (contentColor != null) {
ListItemDefaults.colors(
containerColor = Color.Transparent,
headlineColor = contentColor,
leadingIconColor = contentColor,
supportingColor = contentColor,
trailingIconColor = contentColor,
)
} else {
ListItemDefaults.colors(containerColor = Color.Transparent)
}