2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 13:36:50 +00:00

Add overlay text to barcode scanner view

This commit is contained in:
Oliver Walters 2021-02-15 21:14:24 +11:00
parent 80247f84c1
commit 47e4e13878
3 changed files with 32 additions and 3 deletions

View File

@ -28,6 +28,8 @@ class BarcodeHandler {
* based on the response returned from the InvenTree server
*/
String getOverlayText(BuildContext context) => "Barcode Overlay";
BarcodeHandler();
QRViewController _controller;
@ -132,6 +134,9 @@ class BarcodeScanHandler extends BarcodeHandler {
* Scan *any* barcode without context, and then redirect app to correct view
*/
@override
String getOverlayText(BuildContext context) => I18N.of(context).barcodeScanGeneral;
@override
Future<void> onBarcodeUnknown(Map<String, dynamic> data) {
showErrorDialog(
@ -220,6 +225,9 @@ class StockItemBarcodeAssignmentHandler extends BarcodeHandler {
StockItemBarcodeAssignmentHandler(this.item);
@override
String getOverlayText(BuildContext context) => I18N.of(context).barcodeScanAssign;
@override
Future<void> onBarcodeMatched(Map<String, dynamic> data) {
// If the barcode is known, we can't asisgn it to the stock item!
@ -324,7 +332,7 @@ class _QRViewState extends State<InvenTreeQRView> {
this.context = context;
return Scaffold(
body: Column(
body: Stack(
children: <Widget>[
Expanded(
flex: 4,
@ -339,6 +347,21 @@ class _QRViewState extends State<InvenTreeQRView> {
cutOutSize: 300,
),
)
),
Center(
child: Column(
children: [
Spacer(),
Padding(
child: Text(_handler.getOverlayText(context),
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white),
),
padding: EdgeInsets.all(20),
),
]
)
)
],
)
@ -356,6 +379,9 @@ class StockItemScanIntoLocationHandler extends BarcodeHandler {
StockItemScanIntoLocationHandler(this.item);
@override
String getOverlayText(BuildContext context) => I18N.of(context).barcodeScanLocation;
@override
Future<void> onBarcodeMatched(Map<String, dynamic> data) {
// If the barcode points to a 'stocklocation', great!

@ -1 +1 @@
Subproject commit 81a41ca5d698b540af9fd00300d3159ba943a13d
Subproject commit dd7073d7434d5359ebbf9febff4e319ca0ec2ce0

View File

@ -207,10 +207,13 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
icon: FaIcon(FontAwesomeIcons.boxes),
label: I18N.of(context).stock,
),
// TODO - Add in actions when they are written...
/*
BottomNavigationBarItem(
icon: FaIcon(FontAwesomeIcons.wrench),
label: I18N.of(context).actions,
)
*/
]
);
}
@ -225,7 +228,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
return ListView(
children: stockTiles(),
);
case 1:
case 2:
return ListView(
children: ListTile.divideTiles(
context: context,