Merge pull request 'components: public StepNumber with a done state' (#16) from step-number-done into main

Reviewed-on: https://codeberg.org/jlmakiola/floret-kit/pulls/16
This commit is contained in:
Jean-Luc Makiola
2026-10-16 14:52:53 +02:00
2 changed files with 24 additions and 7 deletions
+3
View File
@@ -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
@@ -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,
)
}
}
}