From be3f5c04a99e550ea305d8316ad75759c80bfd68 Mon Sep 17 00:00:00 2001 From: Maciej Procyk Date: Mon, 19 Feb 2024 01:29:25 +0100 Subject: [PATCH] fix qr code --- .../commonMain/kotlin/in/procyk/shin/ui/QrCode.kt | 14 ++------------ .../kotlin/in/procyk/shin/ui/ShortenResponse.kt | 4 +++- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/QrCode.kt b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/QrCode.kt index b754a5b..6262cba 100644 --- a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/QrCode.kt +++ b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/QrCode.kt @@ -1,18 +1,14 @@ package `in`.procyk.shin.ui import androidx.compose.foundation.Image -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.graphics.Brush +import androidx.compose.ui.graphics.Color import `in`.procyk.compose.qrcode.QrData import `in`.procyk.compose.qrcode.options.* import `in`.procyk.compose.qrcode.rememberQrCodePainter @Composable internal fun QrCode(url: String) { - val primaryColor = MaterialTheme.colorScheme.primary - val secondaryColor = MaterialTheme.colorScheme.secondary val painter = rememberQrCodePainter( data = QrData.text(url), ) { @@ -22,13 +18,7 @@ internal fun QrCode(url: String) { frame = QrFrameShape.roundCorners(.25f) } colors { - dark = QrBrush.brush { - Brush.linearGradient( - 0f to secondaryColor, - 1f to primaryColor, - end = Offset(it, it) - ) - } + dark = QrBrush.solid(Color.Black) } } Image(painter, "QR code") diff --git a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenResponse.kt b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenResponse.kt index f6cdcb7..a6a9411 100644 --- a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenResponse.kt +++ b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenResponse.kt @@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.text.ClickableText import androidx.compose.material3.Button import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -87,11 +88,12 @@ internal fun ShortenResponse(shortenedUrl: String?) { ) Spacer(Modifier.height(16.dp)) QrCode(uri) - Button( + OutlinedButton( onClick = { clipboardManager.setText(AnnotatedString(uri)) }, ) { Text("Copy to Clipboard") } + Spacer(Modifier.height(8.dp)) } } }