A Jetpack Compose Library which can be used to generate QR Codes from texts.
This Library can be used to generate QR Codes in any Android Applications from a text or url. It can be used by calling the function qrGenerator(content = "<your_text>"
inside the painter parameter of the
Image composable as Image(painter = qrGenerator(content = "<your_text>"), contentDescription = "QR Image")
. Additional parameters of the qrGenerator function include size and padding which can be used as
qrGenerator(content = "<your_text>", size = <your_size>.dp, padding = <your_padding>.dp)
Add it to your settings.gradle.kts
file using:
dependencyResolutionManagement {
repositories {
maven { url = uri("https://jitpack.io") }
}
}
and in your build.gradle.kts
file using:
dependencies {
implementation("com.github.AbhranilNXT:ComposeQRGenerator:1.1.0")
}
Refer to the below code for using this library :
@Composable
fun Demo() {
Surface(modifier = Modifier.fillMaxSize()) {
Image(painter = qrGenerator(content = "https://github.com/AbhranilNXT/ComposeQRGenerator",
size = 300.dp,
padding = 8.dp), contentDescription = "Demo QR")
}
}
The above code upon execution gets displayed as :
If you have any feedback, please reach out to us at abhranilnxt@gmail.com
Android: Android Studio, Jetpack Compose, ZWing, BitMap Painter
To clone this repo and look into the source code, go to the terminal in your workspace and then type
Contributions are always welcome!
Please adhere to this project's code of conduct
.