Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/siridx/qrcode
A flutter plugin for scanning QR codes. Use AVCaptureSession in iOS and zxing in Android.
https://github.com/siridx/qrcode
android avcapturesession dart flutter-package flutter-plugin ios qr qr-code qrcode qrcode-scanner zxing
Last synced: 2 days ago
JSON representation
A flutter plugin for scanning QR codes. Use AVCaptureSession in iOS and zxing in Android.
- Host: GitHub
- URL: https://github.com/siridx/qrcode
- Owner: SiriDx
- License: mit
- Created: 2019-09-11T09:16:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-20T05:47:33.000Z (about 2 years ago)
- Last Synced: 2024-12-20T09:07:40.147Z (2 days ago)
- Topics: android, avcapturesession, dart, flutter-package, flutter-plugin, ios, qr, qr-code, qrcode, qrcode-scanner, zxing
- Language: Dart
- Homepage:
- Size: 2.28 MB
- Stars: 71
- Watchers: 7
- Forks: 46
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# qrcode
A flutter plugin for scanning QR codes. Use AVCaptureSession in iOS and zxing in Android.## Usage
### Use this package as a library
#### Add dependency
Add this to your package's pubspec.yaml file:
```dart
dependencies:
qrcode: ^1.0.5
```#### Install it
You can install packages from the command line:
with Flutter:
```
$ flutter pub get
```#### Import it
Now in your Dart code, you can use:
```dart
import 'package:qrcode/qrcode.dart';
```### Basic
```dart
class _MyAppState extends State {
QRCaptureController _captureController = QRCaptureController();bool _isTorchOn = false;
@override
void initState() {
super.initState();_captureController.onCapture((data) {
print('onCapture----$data');
});
}@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Stack(
alignment: Alignment.center,
children: [
QRCaptureView(controller: _captureController),
Align(
alignment: Alignment.bottomCenter,
child: _buildToolBar(),
)
],
),
),
);
}Widget _buildToolBar() {
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
FlatButton(
onPressed: () {
_captureController.pause();
},
child: Text('pause'),
),
FlatButton(
onPressed: () {
if (_isTorchOn) {
_captureController.torchMode = CaptureTorchMode.off;
} else {
_captureController.torchMode = CaptureTorchMode.on;
}
_isTorchOn = !_isTorchOn;
},
child: Text('torch'),
),
FlatButton(
onPressed: () {
_captureController.resume();
},
child: Text('resume'),
),
],
);
}
}
```## Integration
### iOS
To use on iOS, you must add the following to your Info.plist```
NSCameraUsageDescription
Camera permission is required for qrcode scanning.
io.flutter.embedded_views_preview```