Skip to content

Instantly share code, notes, and snippets.

@ziglee
ziglee / DashedDivider.kt
Last active February 21, 2023 14:33
Jetpack Compose DashedDivider
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathEffect
@ziglee
ziglee / TextField.kt
Created February 19, 2024 09:27
Compose clickable readonly textfield
OutlinedTextField(
modifier = Modifier
.pointerInput(Unit) {
awaitEachGesture {
awaitFirstDown(pass = PointerEventPass.Initial)
val upEvent =
waitForUpOrCancellation(pass = PointerEventPass.Initial)
if (upEvent != null) {
onClick()
}