Created
October 25, 2025 13:14
-
-
Save Sottti/3b9875e4fef5d42c9400dfd2c0d1222a to your computer and use it in GitHub Desktop.
ChipStateProvider.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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