Created
July 31, 2025 09:05
-
-
Save mahdiPourkazemi/d4f21a2c14b142528c9d84b9fdfaea31 to your computer and use it in GitHub Desktop.
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
@Composable | |
fun Float.dpToPx(): Float = with(LocalDensity.current) { this@dpToPx.dp.toPx() } | |
@Composable | |
fun Int.dpToPx(): Float = with(LocalDensity.current) { this@dpToPx.dp.toPx() } | |
val circleRadius = 12.dp.dpToPx() | |
fun <T> SnapshotStateList<T>.toggle(item: T) { | |
if (contains(item)) remove(item) else add(item) | |
} | |
val selected = remember { mutableStateListOf<String>() } | |
Checkbox( | |
checked = selected.contains("Banana"), | |
onCheckedChange = { selected.toggle("Banana") } | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment