fix(ui): request HIGH error correction for generated QR codes (#6730)

This commit is contained in:
James Rich authored and GitHub committed 2026-08-16 07:45:38 +00:00
1 parent ae7eaa6710
commit cea2c3a015
1 file changed
+5 -1
@@ -27,6 +27,7 @@ import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.LayoutDirection
import qrcode.QRCode
import qrcode.raw.ErrorCorrectionLevel
/**
* Generates a QR code painter directly using the Skia/Compose canvas API in pure Kotlin.
@@ -37,7 +38,10 @@ import qrcode.QRCode
@Suppress("MagicNumber")
@Composable
fun rememberQrCodePainter(text: String, size: Int = 512): Painter {
val qrCode = androidx.compose.runtime.remember(text) { QRCode.ofSquares().build(text) }
val qrCode =
androidx.compose.runtime.remember(text) {
QRCode.ofSquares().withErrorCorrectionLevel(ErrorCorrectionLevel.HIGH).build(text)
}
val rawMatrix = androidx.compose.runtime.remember(qrCode) { qrCode.rawData }
val matrixSize = androidx.compose.runtime.remember(qrCode) { rawMatrix.size }
val quietZone = 4 // QR standard quiet zone is 4 modules on all sides