kidd3166 5b7cc28e7d ios fix | 3 anos atrás | |
---|---|---|
.. | ||
android | 3 anos atrás | |
ios | 3 anos atrás | |
lib | 3 anos atrás | |
CHANGELOG.md | 3 anos atrás | |
LICENSE | 3 anos atrás | |
README.md | 3 anos atrás | |
pubspec.yaml | 3 anos atrás |
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>