QrCode

fun QrCode(text: String, size: Dp, modifier: Modifier = Modifier)

Renders a QR code for text as a square bitmap.

API contract: part of the dapp-ui public surface. Consumers (e.g. Kicks's CreateMatchScreen) call this directly to render arbitrary QR payloads (match-share links, addresses, etc.) without needing the full receive screen. Signature stable from 1.0.0-alpha onward.

Implementation notes:

  • Uses ZXing core's pure-Java QRCodeWriter (no Android-specific deps), then we hand-roll the BitMatrix → ARGB_8888 conversion to keep the APK footprint small. Pulling in zxing-android-core would bring android.hardware.camera along for the ride.

  • Encoded at the bitmap's pixel size, so a 256.dp canvas on an xxhdpi device gets a ~768px QR — sharp at typical scan distances without being wasteful.

  • Error correction level M (~15%) — Lace's mainnet wallet uses the same level. H (~30%) would be more robust but doubles the module count and looks busier on screen.

  • White background, black foreground — most camera apps tune for this contrast. We do not invert in dark mode; some scanners fail when the dark side is the QR data.

Parameters

text

Payload to encode. For receive flows this is a wallet address. The QR width grows with payload length; for the ~95-char Midnight shielded addresses, size should be at least 200.dp to stay scannable.