Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmannZ committed Aug 12, 2020
0 parents commit 0328d3b
Show file tree
Hide file tree
Showing 13 changed files with 1,231 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
10 changes: 10 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 2ae34518b87dd891355ed6c6ea8cb68c4d52bb9d
channel: stable

project_type: package
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## [1.0.0] - 12-08-2020.

- Initial release.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Zino Hofmann B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
181 changes: 181 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# rounded_qr

An easy to use package for creating QR codes that can be rounded, and can have an image in the center.

This package uses the actively maintained [qr](https://pub.dev/packages/qr) package under the hood.

## Usage

### Default

By default the modules in the QR code will have rounded corners with a radius of `4.0`.

```dart
import 'package:flutter/material.dart';
import 'package:rounded_qr/rounded_qr.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: RoundedQR(
data: 'https://flutter.dev',
),
),
),
);
}
}
```

### Squared

The radius of the modules is variable and can be removed completely by setting the `moduleRadius` parameter to `0.0`.

```dart
import 'package:flutter/material.dart';
import 'package:rounded_qr/rounded_qr.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: RoundedQR(
data: 'https://flutter.dev',
moduleRadius: 0.0,
),
),
),
);
}
}
```

### With image

Adding an image to the center can be done by simply passing an `AssetImage` to the `image` parameter.

```dart
import 'package:flutter/material.dart';
import 'package:rounded_qr/rounded_qr.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: RoundedQR(
data: 'https://flutter.dev',
image: AssetImage('assets/images/flutter.png'),
),
),
),
);
}
}
```

### Custom colors

Both the module color and the background color can be changed by setting the `moduleColor` and `backgroundColor` parameters respectively.

> Note that the module color needs to be darker then the background colors to work with most QR code scanners.
```dart
import 'package:flutter/material.dart';
import 'package:rounded_qr/rounded_qr.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: RoundedQR(
data: 'https://flutter.dev',
moduleColor: Colors.blue,
backgroundColor: Colors.grey,
),
),
),
);
}
}
```

### QR version

The version can be changed to allow for more storage just by setting the `typeNumber` to the desired version (1 to 40.)

```dart
import 'package:flutter/material.dart';
import 'package:rounded_qr/rounded_qr.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: RoundedQR(
data: 'https://flutter.dev',
typeNumber: 17,
),
),
),
);
}
}
```

### Error correction

The error correction level can be changed to allow more data bytes to be restored by setting the `errorCorrectLevel` to the desired level.

- Level L (Low) - 7% of data bytes can be restored.
- Level M (Medium) - 15% of data bytes can be restored.
- Level Q (Quartile) - 25% of data bytes can be restored.
- Level H (High) - 30% of data bytes can be restored.

```dart
import 'package:flutter/material.dart';
import 'package:qr/qr.dart'; // we will import the [QrErrorCorrectLevel] from the qr package
import 'package:rounded_qr/rounded_qr.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: RoundedQR(
data: 'https://flutter.dev',
errorCorrectLevel: QrErrorCorrectLevel.H,
),
),
),
);
}
}
```

## Licence

This Flutter package is made available under a [MIT license](https://github.com/zino-hofmann/rounded-qr-flutter/blob/master/LICENSE).
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:pedantic/analysis_options.yaml
Loading

0 comments on commit 0328d3b

Please sign in to comment.