selection-mode-state-holder

Installation
SKILL.md

A multi-select state holder

One @Stable class, held by the screen, read by the row. Two pieces of observable state — whether the mode is on, and which ids are picked — and exactly one way to add to the second:

// adapted
@Stable
class SelectionState(private val limitMessage: String) {
    var isActive by mutableStateOf(false); private set

    private val _selected = mutableStateListOf<String>()
    val selected: List<String> get() = _selected
    val count: Int get() = _selected.size
    val isFull: Boolean get() = _selected.size >= MAX_SELECTION

    fun isSelected(id: String): Boolean = _selected.contains(id)
Installs
2
GitHub Stars
35
First Seen
6 days ago
selection-mode-state-holder — maxrave-dev/kotlin-footguns