Skip to content

Instantly share code, notes, and snippets.

@hubermi
hubermi / SegmentedControl.kt
Created October 7, 2021 07:34 — forked from zach-klippenstein/SegmentedControl.kt
iOS-style segmented control in Compose
package com.squareup.ui.catalog.app
import android.annotation.SuppressLint
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.forEachGesture
import androidx.compose.foundation.gestures.horizontalDrag