Skip to content

Instantly share code, notes, and snippets.

@Sottti
Created October 25, 2025 13:14
Show Gist options
  • Select an option

  • Save Sottti/3b9875e4fef5d42c9400dfd2c0d1222a to your computer and use it in GitHub Desktop.

Select an option

Save Sottti/3b9875e4fef5d42c9400dfd2c0d1222a to your computer and use it in GitHub Desktop.
ChipStateProvider.kt
internal class ChipStateProvider : PreviewParameterProvider<ChipState> {
override val values: Sequence<ChipState> = sequence {
leadingIconValues().forEach { leadingIcon ->
selectedValues().forEach { enabled ->
expandedValues().forEach { expanded ->
labelResIdValues().forEach { checked ->
yield(
ChipState(
expanded = expanded,
labelResId = checked,
leadingIcon = leadingIcon,
selected = enabled,
),
)
}
}
}
}
}
}
private fun expandedValues() = sequenceOf(false, true, null)
private fun labelResIdValues() = sequenceOf(R.string.chip_label, R.string.chip_label_long)
private fun leadingIconValues() = sequenceOf(null, Icons.CheckSmall.filled)
private fun selectedValues() = sequenceOf(false, true)
private fun stateValues() = listOf(Images.Map.state)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment