@OptIn(ExperimentalMaterialApi::class) @Composable funSwipeableDemo() { // Draw a slider-like composable consisting of a red square moving along a // black background, with three states: "A" (min), "B" (middle), and "C" (max). val width = 350.dp val squareSize = 50.dp
val swipeableState = rememberSwipeableState("A") val sizePx = with(LocalDensity.current) { (width - squareSize).toPx() } val anchors = mapOf(0f to "A", sizePx / 2 to "B", sizePx to "C")