From ea95dff195eeb600283693acb39abdbb88d8feb7 Mon Sep 17 00:00:00 2001 From: cli1005 Date: Thu, 21 Apr 2022 11:44:54 +0200 Subject: [PATCH] fix: #1139 - setter updated --- .../lib/data_models/continuous_scan_model.dart | 9 ++++----- .../smooth_app/lib/widgets/smooth_product_carousel.dart | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/smooth_app/lib/data_models/continuous_scan_model.dart b/packages/smooth_app/lib/data_models/continuous_scan_model.dart index 41268a06d01..4a8b96acef8 100644 --- a/packages/smooth_app/lib/data_models/continuous_scan_model.dart +++ b/packages/smooth_app/lib/data_models/continuous_scan_model.dart @@ -35,7 +35,6 @@ class ContinuousScanModel with ChangeNotifier { late DaoProductList _daoProductList; ProductList get productList => _productList; - String? get latestConsultedBarcode => _latestConsultedBarcode; List getBarcodes() => _barcodes; @@ -100,7 +99,7 @@ class ContinuousScanModel with ChangeNotifier { return; } if (_latestScannedBarcode == code || _barcodes.contains(code)) { - setLastConsultedBarcode(code); + lastConsultedBarcode = code; return; } AnalyticsHelper.trackScannedProduct(barcode: code); @@ -129,7 +128,7 @@ class ContinuousScanModel with ChangeNotifier { } _setBarcodeState(barcode, ScannedProductState.LOADING); _cacheOrLoadBarcode(barcode); - setLastConsultedBarcode(barcode); + lastConsultedBarcode = barcode; return true; } if (state == ScannedProductState.FOUND || @@ -142,7 +141,7 @@ class ContinuousScanModel with ChangeNotifier { if (state == ScannedProductState.CACHED) { _updateBarcode(barcode); } - setLastConsultedBarcode(barcode); + lastConsultedBarcode = barcode; return true; } return false; @@ -235,7 +234,7 @@ class ContinuousScanModel with ChangeNotifier { notifyListeners(); } - void setLastConsultedBarcode(String? barcode) { + set lastConsultedBarcode(String? barcode) { _latestConsultedBarcode = barcode; if (barcode != null) { notifyListeners(); diff --git a/packages/smooth_app/lib/widgets/smooth_product_carousel.dart b/packages/smooth_app/lib/widgets/smooth_product_carousel.dart index 61742a4a39f..f8eee2b775d 100644 --- a/packages/smooth_app/lib/widgets/smooth_product_carousel.dart +++ b/packages/smooth_app/lib/widgets/smooth_product_carousel.dart @@ -89,11 +89,11 @@ class _SmoothProductCarouselState extends State { } if (index > 0) { if (reason == CarouselPageChangedReason.manual) { - _model.setLastConsultedBarcode( - barcodes[index - _searchCardAdjustment]); + _model.lastConsultedBarcode = + barcodes[index - _searchCardAdjustment]; } } else if (index == 0) { - _model.setLastConsultedBarcode(null); + _model.lastConsultedBarcode = null; } }, ),