From 3449583225b40ad30a73378e377814c7e846374f Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 16 Oct 2026 14:48:47 +0200 Subject: [PATCH] components: public StepNumber with a done state Apps that build numbered steps from their own rows, e.g. rows that open a setting, can reuse the disc and show a check once a step is carried out. --- CHANGELOG.md | 4 +++ .../floret/components/InstructionSteps.kt | 26 ++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8894c4a..c9f12e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,10 @@ are no binary releases; "version" tracks the shared `version` in the root build ### Added +- **`components`** — `StepNumber` is public, with a `done` flag that swaps the + numeral for a check, for numbered steps an app builds from its own + `GroupedRow`s (e.g. rows that open a setting). + - **`glance`** (new module) — the family's shared home-screen-widget plumbing and M3 Expressive widget vocabulary, built on Jetpack Glance: `FloretGlanceTheme` (dynamic colour on API 31+, app-supplied fallback diff --git a/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InstructionSteps.kt b/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InstructionSteps.kt index 2979ee9..4f2dca2 100644 --- a/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InstructionSteps.kt +++ b/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InstructionSteps.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.rounded.Check import androidx.compose.material.icons.rounded.KeyboardArrowDown import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme @@ -122,9 +123,11 @@ fun InstructionSteps( * accent is what marks the column as a sequence rather than a list of unrelated * settings, and it holds that reading at a glance without a rule down the side. * + * Public for steps an app builds from its own rows, e.g. ones that open a setting. + * [done] swaps the numeral for a check once the step has been carried out. */ @Composable -private fun StepNumber(number: Int) { +fun StepNumber(number: Int, done: Boolean = false) { Box( modifier = Modifier .size(StepNumberSize) @@ -132,12 +135,21 @@ private fun StepNumber(number: Int) { .background(MaterialTheme.colorScheme.primary), contentAlignment = Alignment.Center, ) { - Text( - text = number.toString(), - style = MaterialTheme.typography.labelLarge, - fontWeight = FontWeight.SemiBold, - color = MaterialTheme.colorScheme.onPrimary, - ) + if (done) { + Icon( + imageVector = Icons.Rounded.Check, + contentDescription = null, + tint = MaterialTheme.colorScheme.onPrimary, + modifier = Modifier.size(18.dp), + ) + } else { + Text( + text = number.toString(), + style = MaterialTheme.typography.labelLarge, + fontWeight = FontWeight.SemiBold, + color = MaterialTheme.colorScheme.onPrimary, + ) + } } }