2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-14 03:05:32 +00:00

[refactor] Scan improvements (#577)

* Handle error on unexpected barcode response

* Add ManufacturerPart detail view

* Support barcode scanning for manufacturer part

* Refactoring for null checks

* Ignore selected errors in sentry

* Fix API implementation for ManufacturerPart

* Update release notes

* More error handling

* Decode quantity betterer

* Refactoring

* Add option to confirm checkin details

* Improve response handlign

* Cleanup

* Remove unused imports

* Fix async function

* Fix for assigning custom barcode

* Handle barcode scan result for company

* Fix

* Adjust scan priority

* Refactoring MODEL_TYPE

- Use instead of duplicated const strings

* @override fix
This commit is contained in:
Oliver
2024-12-14 15:24:23 +11:00
committed by GitHub
parent 6b179d108c
commit 524c5469f1
24 changed files with 576 additions and 220 deletions

View File

@ -93,7 +93,7 @@ class _CameraBarcodeControllerState extends InvenTreeBarcodeControllerState {
/*
* Callback function when a barcode is scanned
*/
void _onScanSuccess(Code? code) {
Future<void> onScanSuccess(Code? code) async {
if (scanning_paused) {
return;
@ -122,18 +122,16 @@ class _CameraBarcodeControllerState extends InvenTreeBarcodeControllerState {
if (mounted) {
setState(() {
scanned_code = barcode;
scanning_paused = barcode.isNotEmpty;
});
}
if (barcode.isNotEmpty) {
handleBarcodeData(barcode).then((_) {
pauseScan();
await handleBarcodeData(barcode).then((_) {
if (!single_scanning && mounted) {
// Resume next scan
setState(() {
scanning_paused = false;
});
resumeScan();
}
});
}
@ -186,7 +184,7 @@ class _CameraBarcodeControllerState extends InvenTreeBarcodeControllerState {
Widget BarcodeReader(BuildContext context) {
return ReaderWidget(
onScan: _onScanSuccess,
onScan: onScanSuccess,
isMultiScan: false,
tryHarder: true,
tryInverted: true,