Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
523fa2e
Update README.md
lukef May 18, 2020
2c85130
Update LICENSE
lukef May 18, 2020
f2d1d7f
Update LICENSE
lukef May 18, 2020
938a983
Added semantics for QrImage (accessibility support) (#93)
nilsreichardt Jul 8, 2020
bea204f
Update LICENSE
lukef Jul 8, 2020
cb6a312
Add eye and data module styling. Absorb foreground color into styling
ankur2136 Jul 8, 2020
e669ec0
Convert foreground color to deprecated instead of deleting it
ankur2136 Jul 8, 2020
0214516
Fix tests to cover cases where foreground color is also defined
ankur2136 Jul 8, 2020
c9a3b70
Fix tests broken due to PR #93 while adding semantics label.
ankur2136 Jul 8, 2020
9337b61
Merge pull request #94 from ankur2136/styling
lukef Jul 8, 2020
ded9636
Fix tests which require image preloading
ankur2136 Jul 8, 2020
f4e85b3
modify colors + update logo
lukef Jul 9, 2020
481d862
Merge pull request #96 from lukef/fix/example-colors-assets
lukef Jul 9, 2020
c231c2f
Merge pull request #95 from ankur2136/preloadFix
lukef Jul 9, 2020
d3cd4ae
Update README.md
lukef Jan 6, 2021
857f058
Update README.md
lukef Jan 6, 2021
453a1c0
add github actions
lukepighetti Mar 14, 2021
80759a2
remove github actions
lukepighetti Mar 14, 2021
1278ca8
WIP Migrate to null safety NNBD v2 (#130)
lukepighetti Mar 14, 2021
807ce7e
add @jonas-zebari to authors (#131)
lukepighetti Mar 14, 2021
411affd
update example project
lukef Mar 14, 2021
8cae5a6
update README
lukef Mar 14, 2021
ba43989
update pubspec
lukef Mar 14, 2021
aa4197f
update docs + specs
lukef Mar 14, 2021
ead5255
bump spec
lukef Mar 14, 2021
e3f8d3d
bump spec
lukef Mar 14, 2021
80b4ccd
Update `qr` to version `^3.0.0`. Bump to `4.0.1`
MichaelDark Dec 16, 2021
1fc6e38
Merge pull request #159 from MichaelDark/master
lukef Feb 22, 2022
955c900
add borderRadius for eyeStyle and dataModuleStyle
alexanderkind Dec 2, 2022
78729a6
Merge pull request #1 from alexanderkind/add-rounded-corners
alexanderkind Dec 2, 2022
c7fbba2
add cutout of image embedded
alexanderkind Dec 3, 2022
397ff01
add gradient
alexanderkind Dec 3, 2022
af0909b
fix gradient
alexanderkind Dec 4, 2022
83804b8
fixed coloring of widgets behind CustomPainter
alexanderkind Dec 5, 2022
ed57b09
Bump version to 4.1.0
vanyasem Apr 30, 2023
8b514b2
Bump constraints
vanyasem Apr 30, 2023
6c32b46
[Android]: Update example for latest Flutter
vanyasem Apr 30, 2023
695f7c2
[Android]: Remove deprecated Splash Screen implementation
vanyasem Apr 30, 2023
ce45ced
[iOS]: Update example for latest Flutter
vanyasem Apr 30, 2023
7e9308c
Remove deprecated author field in pubspec
vanyasem Apr 30, 2023
e897c2a
Update QR dependency
vanyasem Apr 30, 2023
93feb06
added function of rounding outside corners
alexanderkind May 1, 2023
fbffb36
Fix analyzer warnings
vanyasem May 1, 2023
0315bb3
Improve code quality
vanyasem May 1, 2023
5502f62
Add Ivan Semkin to AUTHORS
vanyasem May 1, 2023
ee08fdb
fixed function of rounding outside corners
alexanderkind May 1, 2023
1a54034
fixed outside corners with safe area
alexanderkind May 3, 2023
c2b47e2
Cosmetic code changes
vanyasem May 3, 2023
0a95473
Update tests
vanyasem May 3, 2023
6328b5f
Update changelog and readme
vanyasem May 4, 2023
0f78906
Update package version in README
vanyasem May 4, 2023
fd87cc6
Fix git dependency docs in README
vanyasem May 4, 2023
b30cbf8
dart format
vanyasem May 5, 2023
3937f32
Merge pull request #204 from vanyasem/ivan
lukef May 13, 2023
0f4e545
bump gradle version
lukef May 14, 2023
e77ac65
bump SDK version
lukef May 14, 2023
ffbb276
fix code warnings
lukef May 14, 2023
8a64f0c
Merge branch 'master' of https://github.com/theyakka/qr.flutter
alexanderkind May 31, 2023
5ca1a5f
Change README.md
alexanderkind May 31, 2023
4fb4c4d
Merge pull request #202 from alexanderkind/master
lukef May 16, 2024
d5e7206
Update README.md
lukef May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ Roman Rodych: @romkor
Charles Crete: @cretezy
Dmitry: @kelegorm
Pedro Massango: @pedromassango
Luke Pighetti: @lukepighetti
Luke Pighetti: @lukepighetti
Jonas Zebari: @jonas-zebari
Ivan Semkin: @vanyasem
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# 4.1.0
- Bump `qr` dependency (from `^3.0.0` to `^3.0.1`).

# 4.0.1
- Bump `qr` dependency (from `^2.0.0` to `^3.0.0`).
- **BREAKING**: Rename `QrImage` to `QrImageView`

# 4.0.0
- Migrate to null safety

# 3.2.0
- Fix issue where finder patterns don't render correctly with the painter
- Small fixes + optimizations
Expand Down
36 changes: 19 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
QR.Flutter
BSD 3-Clause License

Copyright (c) 2019 the QR.Flutter authors.
Copyright (c) 2020, Luke Freeman.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the flutter QR authors, nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
113 changes: 86 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

# Need help?

Please do not submit an issue for a "How do i ..?" or "What is the deal with ..?" type question. They will pretty much be closed instantly. If you have questions, please ask them on the Discussions board or on Stack Overflow. They will get answered there.

Using issues creates a large amount of noise and results in real issues getting fixed slower.

# Features
- Null safety
- Built on [QR - Dart](https://github.com/kevmoo/qr.dart)
- Automatic QR code version/type detection or manual entry
- Supports QR code versions 1 - 40
Expand All @@ -14,11 +21,14 @@ QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widg

# Installing

**Version compatibility**: 4.0.0+ supports null safety and requires a version of Flutter that is compatible.
If you're using an incompatible version of flutter, please use a 3.x version of this library.

You should add the following to your `pubspec.yaml` file:

```yaml
dependencies:
qr_flutter: ^3.2.0
qr_flutter: ^4.1.0
```

**Note**: If you're using the Flutter `master` channel, if you encounter build issues, or want to try the latest and greatest then you should use the `master` branch and not a specific release version. To do so, use the following configuration in your `pubspec.yaml`:
Expand All @@ -27,7 +37,7 @@ dependencies:
dependencies:
qr_flutter:
git:
url: git://github.com/lukef/qr.flutter.git
url: https://github.com/theyakka/qr.flutter
```

Keep in mind the `master` branch could be unstable.
Expand All @@ -45,29 +55,37 @@ import 'package:qr_flutter/qr_flutter.dart';
Next, to render a basic QR code you can use the following code (or something like it):

```dart
QrImage(
data: "1234567890",
QrImageView(
data: '1234567890',
version: QrVersions.auto,
size: 200.0,
),
```

Depending on your data requirements you may want to tweak the QR code output. The following options are available:

| Property | Type | Description |
|----|----|----|
| `version` | int | `QrVersions.auto` or a value between 1 and 40. See http://www.qrcode.com/en/about/version.html for limitations and details. |
| `errorCorrectionLevel` | int | A value defined on `QrErrorCorrectLevel`. e.g.: `QrErrorCorrectLevel.L`. |
| `size` | double | The (square) size of the image. If not given, will auto size using shortest size constraint. |
| `padding` | EdgeInsets | Padding surrounding the QR code data. |
| `backgroundColor` | Color | The background color (default is none). |
| `foregroundColor` | Color | The foreground color (default is black). |
| `gapless` | bool | Adds an extra pixel in size to prevent gaps (default is true). |
| `errorStateBuilder` | QrErrorBuilder | Allows you to show an error state `Widget` in the event there is an error rendering the QR code (e.g.: version is too low, input is too long, etc). |
| `constrainErrorBounds` | bool | If true, the error `Widget` will be constrained to the square that the QR code was going to be drawn in. If false, the error state `Widget` will grow/shrink to whatever size it needs. |
| `embeddedImage` | ImageProvider | An `ImageProvider` that defines an image to be overlaid in the center of the QR code. |
| `embeddedImageStyle` | QrEmbeddedImageStyle | Properties to style the embedded image. |
| `embeddedImageEmitsError` | bool | If true, any failure to load the embedded image will trigger the `errorStateBuilder` or render an empty `Container`. If false, the QR code will be rendered and the embedded image will be ignored. |
| Property | Type | Description |
|---------------------------|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `version` | int | `QrVersions.auto` or a value between 1 and 40. See http://www.qrcode.com/en/about/version.html for limitations and details. |
| `errorCorrectionLevel` | int | A value defined on `QrErrorCorrectLevel`. e.g.: `QrErrorCorrectLevel.L`. |
| `size` | double | The (square) size of the image. If not given, will auto size using shortest size constraint. |
| `padding` | EdgeInsets | Padding surrounding the QR code data. |
| `backgroundColor` | Color | The background color (default is none). |
| `eyeStyle` | QrEyeStyle | Configures the QR code eyes' (corners') shape and color. |
| `dataModuleStyle` | QrDataModuleStyle | Configures the shape and the color of the dots. |
| `gapless` | bool | Adds an extra pixel in size to prevent gaps (default is true). |
| `errorStateBuilder` | QrErrorBuilder | Allows you to show an error state `Widget` in the event there is an error rendering the QR code (e.g.: version is too low, input is too long, etc). |
| `constrainErrorBounds` | bool | If true, the error `Widget` will be constrained to the square that the QR code was going to be drawn in. If false, the error state `Widget` will grow/shrink to whatever size it needs. |
| `embeddedImage` | ImageProvider | An `ImageProvider` that defines an image to be overlaid in the center of the QR code. |
| `embeddedImageStyle` | QrEmbeddedImageStyle | Properties to style the embedded image. |
| `embeddedImageEmitsError` | bool | If true, any failure to load the embedded image will trigger the `errorStateBuilder` or render an empty `Container`. If false, the QR code will be rendered and the embedded image will be ignored. |
| `semanticsLabel` | String | `semanticsLabel` will be used by screen readers to describe the content of the QR code. |
| `borderRadius` | double | Setting corner rounding for shape types `QrEyeShape.square`, `QrDataModuleShape.square`, `EmbeddedImageShape.square`. Set in appropriate styles. |
| `roundedOutsideCorners` | bool | If true, the outer corners of the data are rounded. Set to `QrDataModuleStyle`. Rounded to `borderRadius` by default. Only `QrDataModuleShape.square`. |
| `outsideBorderRadius` | double | It is set if the outer rounding `outsideBorderRadius` should differ from the inner one `borderRadius`. No more than `borderRadius`. Only `QrDataModuleShape.square` |
| `gradient` | Gradient | Changing the solid color of the code to a gradient, e.g. `LinearGradient`. |
| `safeArea` | bool | If true, data is hidden behind the `embeddedImage`. Set to `QrEmbeddedImageStyle`. |
| `safeAreaMultiplier` | double | Multiplier `safeArea` size. |

# Examples

Expand All @@ -79,7 +97,7 @@ Also, the following examples give you a quick overview on how to use the library
A basic QR code will look something like:

```dart
QrImage(
QrImageView(
data: 'This is a simple QR code',
version: QrVersions.auto,
size: 320,
Expand All @@ -90,7 +108,7 @@ QrImage(
A QR code with an image (from your application's assets) will look like:

```dart
QrImage(
QrImageView(
data: 'This QR code has an embedded image as well',
version: QrVersions.auto,
size: 320,
Expand All @@ -105,7 +123,7 @@ QrImage(
To show an error state in the event that the QR code can't be validated:

```dart
QrImage(
QrImageView(
data: 'This QR code will show the error state instead',
version: 1,
size: 320,
Expand All @@ -114,7 +132,7 @@ QrImage(
return Container(
child: Center(
child: Text(
"Uh oh! Something went wrong...",
'Uh oh! Something went wrong...',
textAlign: TextAlign.center,
),
),
Expand All @@ -123,13 +141,54 @@ QrImage(
)
```

A QR code with inside and outside corners rounding and safe area of embedded image:

```dart
QrImageView(
data: 'London is the capital of Great Britain',
version: QrVersions.auto,
size: 320,
eyeStyle: const QrEyeStyle(
borderRadius: 10,
),
dataModuleStyle: const QrDataModuleStyle(
borderRadius: 5,
roundedOutsideCorners: true,
),
embeddedImage: AssetImage('assets/images/my_embedded_image.png'),
embeddedImageStyle: QrEmbeddedImageStyle(
size: Size.square(40),
color: Colors.white,
safeArea: true,
safeAreaMultiplier: 1.1,
embeddedImageShape: EmbeddedImageShape.square,
borderRadius: 10,
),
)
```

# FAQ
## Has it been tested in production? Can I use it in production?
A QR code with gradient:

Yep! It's stable and ready to rock. It's currently in use in quite a few production applications including:
- Sixpoint: [Android](https://play.google.com/store/apps/details?id=com.sixpoint.sixpoint&hl=en_US) & [iOS](https://itunes.apple.com/us/app/sixpoint/id663008674?mt=8)
```dart
QrImageView(
data: 'Rainbow after the rain',
version: QrVersions.auto,
size: 320,
gradient: LinearGradient(
begin: Alignment.bottomLeft,
end: Alignment.topRight,
colors: [
Color(0xffff0000),
Color(0xffffa500),
Color(0xffffff00),
Color(0xff008000),
Color(0xff0000ff),
Color(0xff4b0082),
Color(0xffee82ee),
],
),
)
```

# Outro
## Credits
Expand All @@ -139,4 +198,4 @@ For author/contributor information, see the `AUTHORS` file.

## License

QR.Flutter is released under a modified MIT license. See `LICENSE` for details.
QR.Flutter is released under a BSD-3 license. See `LICENSE` for details.
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ linter:
# libraries
# classes
- one_member_abstracts # avoid
- avoid_classes_with_only_static_members # avoid
- public_member_api_docs
# constructors
- prefer_constructors_over_static_methods
Expand Down
11 changes: 11 additions & 0 deletions example/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
22 changes: 15 additions & 7 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28
compileSdkVersion flutter.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -37,10 +46,9 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "app.yakka.example"
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -60,8 +68,8 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
3 changes: 2 additions & 1 deletion example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.yakka.example">
<!-- Flutter needs it to communicate with the running application
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
19 changes: 11 additions & 8 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,30 @@
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
package app.yakka.example

import android.os.Bundle

import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant
import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
}
}
Loading