Closed seth35us closed 2 years ago
Please try the latest commit. It should work now 👍🏼
Your fix worked great! However, I am having issues reading anything other than QR codes on iOS. I am testing on iOS 14.7.1 Here is my code:
` @override Widget build(BuildContext context) { // ignore: avoid_print print('Build QR View');
final List<BarcodeType> barcodeTypes = [
BarcodeType.aztec,
BarcodeType.code128,
BarcodeType.code39,
BarcodeType.code93,
BarcodeType.dataMatrix,
BarcodeType.ean13,
BarcodeType.ean8,
BarcodeType.itf,
BarcodeType.pdf417,
BarcodeType.qr,
BarcodeType.upcA,
BarcodeType.upcE
];
if (Platform.isAndroid) {
// this code doesn't work on iOS yet
barcodeTypes.add(BarcodeType.codabar);
}
if (Platform.isIOS) {
// this code doesn't work on Android yet
barcodeTypes.add(BarcodeType.code39mod43);
barcodeTypes.add(BarcodeType.interleaved);
}
return FutureBuilder<bool>(
future: hasCameraPermission(context),
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
Widget child;
if (snapshot.hasData) {
if (snapshot.data == true) {
child = BarcodeCamera(
types: barcodeTypes,
mode: sharedPrefs.batchScan
? DetectionMode.pauseVideo
: DetectionMode.pauseVideo,
position: cameraPosition,
onScan: (barcode) => onScan(barcode),
children: [
const ScanOverlay(),
if (sharedPrefs.batchScan) const BlurPreviewOverlay(),
],
);
} else {
child = Container(
color: Colors.black,
);
}
} else {
child = Container(
color: Colors.black,
);
}
return child;
});
}
Future
PermissionsHelper().handleCameraPermission(context, (val) {
if (!perComp.isCompleted) {
perComp.complete(val);
}
});
return perComp.future;
} `
That's weird. I did some tests with EAN13 earlier and it worked fine.
I am thinking about adding unit tests with sample code images to check if every type is recognized as expected.
Not sure why iOS wasn’t scanning. I tried again today and it was working perfectly. I tried every possible barcode type. Thanks for checking.
The only other problem I had was on Android calling resumeScanner didn’t work after scanning and staying on the same page on Android. I had to call pauseCamera and resumeCamera on Android for it to scan again. I used pauseDetection after scanning.
Are you using DetectionMode.pauseDetection? The behavior should be the same on iOS and Android.
Edit:
Does it work on the current main
branch? If not, I'll look into the pauseDetection
issue.
https://github.com/jhoogstraat/fast_barcode_scanner/issues/27#issuecomment-922474865
@jhoogstraat i'm having the same issue.
It looks like version 1.1.2 fixed this. I am using DetectionMode.pauseVideo and CameraController.instance.resumeDetector(). @guilhermedaldim are you still seeing the issue with those settings on the most recent build?
I no longer see this issue in the latest version.
@jhoogstraat adjusted this as commented here https://github.com/jhoogstraat/fast_barcode_scanner/issues/27#issuecomment-923951603.
I copied the example code from the update-config branch into a new project with a bottom navigation bar. When switching tabs, I get both camera initialization and camera dispose errors.
I have included a sample main class for your review. So far, I have not figured out the root cause of the issue.
You should be able to just replace your main and replicate the issue. Please let me know if you need more information on this.
main.dart.zip