diff --git a/CHANGELOG.md b/CHANGELOG.md index cc88271..9caee90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ 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). - **`core-prefs`** — `Preferences[pref]` and `MutablePreferences[pref] = value`, so an app can read several prefs out of one `PrefStore.data` snapshot and write several in one `PrefStore.edit` without dropping to raw keys. Plus 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 e8dfa21..3571bdb 100644 --- a/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InstructionSteps.kt +++ b/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InstructionSteps.kt @@ -6,6 +6,9 @@ import androidx.compose.foundation.layout.Column 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.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -117,9 +120,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) @@ -127,12 +132,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, + ) + } } }