|
|
7 anni fa | |
|---|---|---|
| .resources | 7 anni fa | |
| android | 7 anni fa | |
| example | 7 anni fa | |
| ios | 7 anni fa | |
| lib | 7 anni fa | |
| .packages | 7 anni fa | |
| CHANGELOG.md | 7 anni fa | |
| LICENSE | 7 anni fa | |
| README.md | 7 anni fa | |
| pubspec.yaml | 7 anni fa | |
A QR code scanner that works on both iOS and Android by natively embedding the platform view within Flutter. The integration with Flutter is seamless, much better than jumping into a native Activity or a ViewController to perform the scan.
| Android | |
|---|---|
|
|
|
| iOS | |
|
|
|
When a QR code is recognized, the text identified will be set in ‘qrText’.
class _QRViewExampleState extends State<QRViewExample> {
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
var qrText = "";
QRViewController controller;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: <Widget>[
QRView(
key: qrKey,
onQRViewCreated: _onQRViewCreated,
),
],
),
);
}
void _onQRViewCreated(QRViewController controller) {
final channel = controller.channel;
controller.init(qrKey);
this.controller = controller;
channel.setMethodCallHandler((MethodCall call) async {
switch (call.method) {
case "onRecognizeQR":
dynamic arguments = call.arguments;
setState(() {
qrText = arguments.toString();
});
}
});
}
}
The default camera is the back camera.
controller.flipCamera();
By default, flash is OFF.
controller.flipFlash();