2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Barcode handler code cleanup

This commit is contained in:
Oliver 2021-07-30 11:09:01 +10:00
parent b423d43db8
commit 07017c4745
3 changed files with 12 additions and 13 deletions

View File

@ -292,9 +292,6 @@ class StockItemBarcodeAssignmentHandler extends BarcodeHandler {
failureTone(); failureTone();
// Close the barcode scanner
_controller?.dispose();
Navigator.of(context).pop(); Navigator.of(context).pop();
showSnackIcon( showSnackIcon(
@ -317,10 +314,6 @@ class StockItemBarcodeAssignmentHandler extends BarcodeHandler {
} }
} }
class StockItemScanIntoLocationHandler extends BarcodeHandler { class StockItemScanIntoLocationHandler extends BarcodeHandler {
/* /*
* Barcode handler for scanning a provided StockItem into a scanned StockLocation * Barcode handler for scanning a provided StockItem into a scanned StockLocation
@ -338,7 +331,16 @@ class StockItemScanIntoLocationHandler extends BarcodeHandler {
// If the barcode points to a 'stocklocation', great! // If the barcode points to a 'stocklocation', great!
if (data.containsKey('stocklocation')) { if (data.containsKey('stocklocation')) {
// Extract location information // Extract location information
int location = data['stocklocation']['pk'] as int; int location = (data['stocklocation']['pk'] ?? -1) as int;
if (location == -1) {
showSnackIcon(
L10().invalidStockLocation,
success: false,
);
return;
}
// Transfer stock to specified location // Transfer stock to specified location
final result = await item.transferStock(location); final result = await item.transferStock(location);
@ -347,9 +349,6 @@ class StockItemScanIntoLocationHandler extends BarcodeHandler {
successTone(); successTone();
// Close the scanner
_controller?.dispose();
Navigator.of(context).pop(); Navigator.of(context).pop();
showSnackIcon( showSnackIcon(

View File

@ -475,7 +475,7 @@ packages:
name: qr_code_scanner name: qr_code_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.1" version: "0.5.2"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:

View File

@ -24,7 +24,7 @@ dependencies:
cupertino_icons: ^1.0.3 cupertino_icons: ^1.0.3
http: ^0.13.0 http: ^0.13.0
cached_network_image: ^3.0.0 # Download and cache remote images cached_network_image: ^3.0.0 # Download and cache remote images
qr_code_scanner: ^0.5.1 # Barcode scanning qr_code_scanner: ^0.5.2 # Barcode scanning
package_info_plus: ^1.0.4 # App information introspection package_info_plus: ^1.0.4 # App information introspection
device_info_plus: ^2.1.0 # Information about the device device_info_plus: ^2.1.0 # Information about the device
font_awesome_flutter: ^9.1.0 # FontAwesome icon set font_awesome_flutter: ^9.1.0 # FontAwesome icon set