refactor: Refactors reception scan and updates app name

Optimizes product lookup during reception scanning by removing redundant database calls.
Adds error feedback for quantity increment failures, enhancing user experience.
Updates the application name from 'BarcodeScan' to 'eScan'.
This commit is contained in:
your-name 2025-07-31 04:31:55 +03:00
parent 5f158fb24e
commit e6901eae8f
2 changed files with 10 additions and 15 deletions

View File

@ -38,7 +38,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
backgroundColor: AppTheme.of(context).primaryBackground,
appBar: AppBar(
title: Text(
'BarcodeScan',
'eScan',
textAlign: TextAlign.center,
style: AppTheme.of(context).titleLarge,
),

View File

@ -103,18 +103,17 @@ class _ReceptionScanPageState extends ConsumerState<ReceptionScanPage>
return;
}
// find product in local database
final isProductExist = model.getProduct(
final product = model.getProduct(
receptionId: widget.receptionId,
barcode: qrcodeValue,
);
if (isProductExist != null) {
final product = model.getProduct(
receptionId: widget.receptionId,
barcode: qrcodeValue,
);
if (product != null) {
model.incrementMoveLineQuantity(
barcode: qrcodeValue,
receptionId: widget.receptionId,
onError: () {
Toast.showError('Aucun produit trouvé.');
},
);
//show dialog
await showDialog(
@ -137,7 +136,7 @@ class _ReceptionScanPageState extends ConsumerState<ReceptionScanPage>
child: SizedBox(
width: MediaQuery.sizeOf(context).width * 0.9,
child: ProductScannedComponent(
productStruct: product!,
productStruct: product,
onRescan: () async {
Navigator.of(context).pop();
qrcodeFound = false;
@ -169,15 +168,11 @@ class _ReceptionScanPageState extends ConsumerState<ReceptionScanPage>
final model = ref.read(receptionScanPageModelProvider.notifier);
mobileScannerController.stop();
// find product in local database
final isProductExist = model.getProduct(
final product = model.getProduct(
receptionId: widget.receptionId,
barcode: qrcodeValue,
);
if (isProductExist != null) {
final product = model.getProduct(
receptionId: widget.receptionId,
barcode: qrcodeValue,
);
if (product != null) {
model.incrementMoveLineQuantity(
barcode: qrcodeValue,
receptionId: widget.receptionId,
@ -206,7 +201,7 @@ class _ReceptionScanPageState extends ConsumerState<ReceptionScanPage>
child: SizedBox(
width: MediaQuery.sizeOf(context).width * 0.9,
child: ProductScannedComponent(
productStruct: product!,
productStruct: product,
onRescan: () async {
qrcodeFound = false;
mobileScannerController.start();