2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 18:25:26 +00:00

Barcode refactor (#381)

* Simplify barcode scanning interface

* Use consistent colors

* Fix notches

* Remove old comment
This commit is contained in:
Oliver
2023-06-24 21:06:08 +10:00
committed by GitHub
parent e9eb84eace
commit 925966c627
8 changed files with 45 additions and 50 deletions

View File

@ -181,21 +181,18 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> with BaseWidgetPr
),
),
onTap: () {
if (!allowed) {
showSnackIcon(
L10().permissionRequired,
icon: FontAwesomeIcons.circleExclamation,
success: false,
);
return;
}
if (callback != null) {
callback();
}
},
);
}

View File

@ -91,11 +91,9 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
child: FaIcon(FontAwesomeIcons.qrcode),
label: L10().barcodeScanItem,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) =>
barcodeController(
StockLocationScanInItemsHandler(location!)))
scanBarcode(
context,
handler: StockLocationScanInItemsHandler(location!),
).then((value) {
refresh(context);
});
@ -111,11 +109,9 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
child: FaIcon(FontAwesomeIcons.qrcode),
label: L10().transferStockLocation,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) =>
barcodeController(ScanParentLocationHandler(location!))
)
scanBarcode(
context,
handler: ScanParentLocationHandler(location!),
).then((value) {
refresh(context);
});

View File

@ -102,15 +102,22 @@ mixin BaseWidgetProperties {
iconSize: iconSize,
onPressed: () {
if (InvenTreeAPI().checkConnection()) {
scanQrCode(context);
scanBarcode(context);
}
},
)
];
return BottomAppBar(
shape: CircularNotchedRectangle(),
notchMargin: 20,
shape: AutomaticNotchedShape(
RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
),
RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(40)),
),
),
notchMargin: 10,
child: IconTheme(
data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary),
child: Row(

View File

@ -165,12 +165,9 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
child: Icon(Icons.qr_code_scanner),
label: L10().scanIntoLocation,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) =>
barcodeController(
StockItemScanIntoLocationHandler(widget.item))
)
scanBarcode(
context,
handler: StockItemScanIntoLocationHandler(widget.item)
).then((ctx) {
refresh(context);
});