mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-11-04 15:25:48 +00:00 
			
		
		
		
	Add overlay text to barcode scanner view
This commit is contained in:
		@@ -28,6 +28,8 @@ class BarcodeHandler {
 | 
				
			|||||||
   * based on the response returned from the InvenTree server
 | 
					   * based on the response returned from the InvenTree server
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    String getOverlayText(BuildContext context) => "Barcode Overlay";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    BarcodeHandler();
 | 
					    BarcodeHandler();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QRViewController _controller;
 | 
					    QRViewController _controller;
 | 
				
			||||||
@@ -132,6 +134,9 @@ class BarcodeScanHandler extends BarcodeHandler {
 | 
				
			|||||||
   * Scan *any* barcode without context, and then redirect app to correct view
 | 
					   * Scan *any* barcode without context, and then redirect app to correct view
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  String getOverlayText(BuildContext context) => I18N.of(context).barcodeScanGeneral;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Future<void> onBarcodeUnknown(Map<String, dynamic> data) {
 | 
					  Future<void> onBarcodeUnknown(Map<String, dynamic> data) {
 | 
				
			||||||
    showErrorDialog(
 | 
					    showErrorDialog(
 | 
				
			||||||
@@ -220,6 +225,9 @@ class StockItemBarcodeAssignmentHandler extends BarcodeHandler {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  StockItemBarcodeAssignmentHandler(this.item);
 | 
					  StockItemBarcodeAssignmentHandler(this.item);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  String getOverlayText(BuildContext context) => I18N.of(context).barcodeScanAssign;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Future<void> onBarcodeMatched(Map<String, dynamic> data) {
 | 
					  Future<void> onBarcodeMatched(Map<String, dynamic> data) {
 | 
				
			||||||
    // If the barcode is known, we can't asisgn it to the stock item!
 | 
					    // 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;
 | 
					    this.context = context;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Scaffold(
 | 
					    return Scaffold(
 | 
				
			||||||
      body: Column(
 | 
					      body: Stack(
 | 
				
			||||||
        children: <Widget>[
 | 
					        children: <Widget>[
 | 
				
			||||||
          Expanded(
 | 
					          Expanded(
 | 
				
			||||||
            flex: 4,
 | 
					            flex: 4,
 | 
				
			||||||
@@ -339,6 +347,21 @@ class _QRViewState extends State<InvenTreeQRView> {
 | 
				
			|||||||
                cutOutSize: 300,
 | 
					                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);
 | 
					  StockItemScanIntoLocationHandler(this.item);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  String getOverlayText(BuildContext context) => I18N.of(context).barcodeScanLocation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Future<void> onBarcodeMatched(Map<String, dynamic> data) {
 | 
					  Future<void> onBarcodeMatched(Map<String, dynamic> data) {
 | 
				
			||||||
    // If the barcode points to a 'stocklocation', great!
 | 
					    // If the barcode points to a 'stocklocation', great!
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								lib/l10n
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								lib/l10n
									
									
									
									
									
								
							 Submodule lib/l10n updated: 81a41ca5d6...dd7073d743
									
								
							@@ -207,10 +207,13 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
 | 
				
			|||||||
            icon: FaIcon(FontAwesomeIcons.boxes),
 | 
					            icon: FaIcon(FontAwesomeIcons.boxes),
 | 
				
			||||||
            label: I18N.of(context).stock,
 | 
					            label: I18N.of(context).stock,
 | 
				
			||||||
          ),
 | 
					          ),
 | 
				
			||||||
 | 
					          // TODO - Add in actions when they are written...
 | 
				
			||||||
 | 
					          /*
 | 
				
			||||||
          BottomNavigationBarItem(
 | 
					          BottomNavigationBarItem(
 | 
				
			||||||
            icon: FaIcon(FontAwesomeIcons.wrench),
 | 
					            icon: FaIcon(FontAwesomeIcons.wrench),
 | 
				
			||||||
            label: I18N.of(context).actions,
 | 
					            label: I18N.of(context).actions,
 | 
				
			||||||
          )
 | 
					          )
 | 
				
			||||||
 | 
					           */
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -225,7 +228,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
 | 
				
			|||||||
        return ListView(
 | 
					        return ListView(
 | 
				
			||||||
          children: stockTiles(),
 | 
					          children: stockTiles(),
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
      case 1:
 | 
					      case 2:
 | 
				
			||||||
        return ListView(
 | 
					        return ListView(
 | 
				
			||||||
          children: ListTile.divideTiles(
 | 
					          children: ListTile.divideTiles(
 | 
				
			||||||
            context: context,
 | 
					            context: context,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user