kidd3166 2b9b8df426 bug fixed | 3 gadi atpakaļ | |
---|---|---|
.. | ||
android | 3 gadi atpakaļ | |
ios | 3 gadi atpakaļ | |
lib | 3 gadi atpakaļ | |
CHANGELOG.md | 3 gadi atpakaļ | |
LICENSE | 3 gadi atpakaļ | |
README.md | 3 gadi atpakaļ | |
pubspec.yaml | 3 gadi atpakaļ |
A QR code scanner flutter plugin project. Support iOS, Android.
import 'package:flutter_plugin_qr_scanner/qrscanner.dart';
Future<void> initCodeState() async {
String code;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
code = await QrScanner.scan(
title: "scanner",
laserColor: Colors.white, //default #ffff55ff
playBeep: true, //default false
promptMessage: "Point the QR code to the frame to complete the scan.",
errorMsg: "Oops, something went wrong. You may need to check your permission of camera or restart the device.",
permissionDeniedText: "Your privacy settings seem to prevent us from accessing your camera for barcode scanning. You can fix it by doing this, touch the OK button below to open the Settings and then turn the Camera on.",
messageConfirmText: "OK",
messageCancelText: "Cancel",
);
} on PlatformException {
code = 'Failed to get qr code.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_code = code;
});
}
You will need provide the description of camera's permission to work properly, otherwise will crash your app.
<key>NSCameraUsageDescription</key>
<string>The purpose that you use the camera</string>