11# Compose QR Code
2+
23__ A simple, flexible QR code renderer for Jetpack Compose - by * Lightspark* __
34
45| <img src =" ./docs/images/purple_and_gold.png " width =" 150px " height =" 150px " /> | <img src =" ./docs/images/lightning.png " width =" 150px " height =" 150px " /> | <img src =" ./docs/images/light_smile_square.png " width =" 150px " height =" 150px " /> | <img src =" ./docs/images/dark_smile_circle.png " width =" 150px " height =" 150px " /> |
5- | --- | --- | --- | --- |
6+ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
67
78## Usage
89
@@ -40,20 +41,14 @@ Meh... Let's spice it up a bit with a smiley face overlay:
4041fun SmileyPreview () {
4142 QrCodeView (
4243 data = " https://github.com/lightsparkdev/compose-qr-code" ,
43- modifier = Modifier .size(300 .dp),
44- overlayContent = {
45- Box (
46- contentAlignment = Alignment .Center ,
47- modifier = Modifier .fillMaxSize()
48- ) {
49- Smile (
50- modifier = Modifier .fillMaxSize(),
51- backgroundColor = Color .Yellow ,
52- smileColor = Color .Black
53- )
54- }
55- }
56- )
44+ modifier = Modifier .size(300 .dp)
45+ ) {
46+ Smile (
47+ modifier = Modifier .fillMaxSize(),
48+ backgroundColor = Color .Yellow ,
49+ smileColor = Color .Black
50+ )
51+ }
5752}
5853```
5954
@@ -64,7 +59,8 @@ fun SmileyPreview() {
6459</tr >
6560</table >
6661
67- Cool, I guess we're getting somewhere. What about dark mode? Maybe we can also add some style with circular dots in the qr code...
62+ Cool, I guess we're getting somewhere. What about dark mode? Maybe we can also add some style with
63+ circular dots in the qr code...
6864
6965<table >
7066<tr >
@@ -80,21 +76,21 @@ fun SmileyDarkPreview() {
8076 background = Color .Black ,
8177 foreground = Color .White
8278 ),
83- dotShape = DotShape .Circle ,
84- overlayContent = {
85- Box (
86- contentAlignment = Alignment .Center ,
87- modifier = Modifier
88- .fillMaxSize()
89- .clip(RoundedCornerShape (8 .dp))
90- .background(Color .White )
91- .padding(8 .dp)
92- .clip(RoundedCornerShape (8 .dp))
93- .background(Color .Green )
94- ) {
95- Smile (modifier = Modifier .fillMaxSize(0.5f ))
96- }
97- })
79+ dotShape = DotShape .Circle
80+ ) {
81+ Box (
82+ contentAlignment = Alignment .Center ,
83+ modifier = Modifier
84+ .fillMaxSize()
85+ .clip(RoundedCornerShape (8 .dp))
86+ .background(Color .White )
87+ .padding(8 .dp)
88+ .clip(RoundedCornerShape (8 .dp))
89+ .background(Color .Green )
90+ ) {
91+ Smile (modifier = Modifier .fillMaxSize(0.5f ))
92+ }
93+ }
9894}
9995```
10096
@@ -118,34 +114,33 @@ fun PurpleAndGold() {
118114 val purple = Color (0xFF552583 )
119115 val gold = Color (0xFFFDB927 )
120116 QrCodeView (
121- data = URL_DATA ,
117+ data = " https://github.com/lightsparkdev/compose-qr-code " ,
122118 modifier = Modifier .size(300 .dp),
123119 colors = QrCodeColors (
124120 background = purple,
125121 foreground = gold
126122 ),
127- dotShape = DotShape .Circle ,
128- overlayContent = {
129- Box (
130- contentAlignment = Alignment .Center ,
131- modifier = Modifier
132- .fillMaxSize()
133- .clip(CircleShape )
134- .background(purple)
135- ) {
136- BasicText (
137- text = " L" ,
138- style = TextStyle .Default .copy(
139- color = gold,
140- fontSize = 42 .sp,
141- fontWeight = FontWeight .ExtraBold ,
142- fontStyle = FontStyle .Italic ,
143- fontFamily = FontFamily .Serif
144- )
123+ dotShape = DotShape .Circle
124+ ) {
125+ Box (
126+ contentAlignment = Alignment .Center ,
127+ modifier = Modifier
128+ .fillMaxSize()
129+ .clip(CircleShape )
130+ .background(purple)
131+ ) {
132+ BasicText (
133+ text = " L" ,
134+ style = TextStyle .Default .copy(
135+ color = gold,
136+ fontSize = 42 .sp,
137+ fontWeight = FontWeight .ExtraBold ,
138+ fontStyle = FontStyle .Italic ,
139+ fontFamily = FontFamily .Serif
145140 )
146- }
141+ )
147142 }
148- )
143+ }
149144}
150145```
151146
@@ -156,6 +151,7 @@ fun PurpleAndGold() {
156151</tr >
157152</table >
158153
159- ## Acknowledgements
154+ ## Acknowledgements
160155
161- This libraries relies on the great, reliable [ zxing] ( https://github.com/zxing/zxing ) library for QR code data generation.
156+ This libraries relies on the great, reliable [ zxing] ( https://github.com/zxing/zxing ) library for QR
157+ code data generation.
0 commit comments