Skip to content

Commit

Permalink
fix: openfoodfacts#1139 - setter updated
Browse files Browse the repository at this point in the history
  • Loading branch information
cli1005 committed Apr 21, 2022
1 parent 167c7b9 commit ea95dff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ContinuousScanModel with ChangeNotifier {
late DaoProductList _daoProductList;

ProductList get productList => _productList;

String? get latestConsultedBarcode => _latestConsultedBarcode;

List<String> getBarcodes() => _barcodes;
Expand Down Expand Up @@ -100,7 +99,7 @@ class ContinuousScanModel with ChangeNotifier {
return;
}
if (_latestScannedBarcode == code || _barcodes.contains(code)) {
setLastConsultedBarcode(code);
lastConsultedBarcode = code;
return;
}
AnalyticsHelper.trackScannedProduct(barcode: code);
Expand Down Expand Up @@ -129,7 +128,7 @@ class ContinuousScanModel with ChangeNotifier {
}
_setBarcodeState(barcode, ScannedProductState.LOADING);
_cacheOrLoadBarcode(barcode);
setLastConsultedBarcode(barcode);
lastConsultedBarcode = barcode;
return true;
}
if (state == ScannedProductState.FOUND ||
Expand All @@ -142,7 +141,7 @@ class ContinuousScanModel with ChangeNotifier {
if (state == ScannedProductState.CACHED) {
_updateBarcode(barcode);
}
setLastConsultedBarcode(barcode);
lastConsultedBarcode = barcode;
return true;
}
return false;
Expand Down Expand Up @@ -235,7 +234,7 @@ class ContinuousScanModel with ChangeNotifier {
notifyListeners();
}

void setLastConsultedBarcode(String? barcode) {
set lastConsultedBarcode(String? barcode) {
_latestConsultedBarcode = barcode;
if (barcode != null) {
notifyListeners();
Expand Down
6 changes: 3 additions & 3 deletions packages/smooth_app/lib/widgets/smooth_product_carousel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ class _SmoothProductCarouselState extends State<SmoothProductCarousel> {
}
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;
}
},
),
Expand Down

0 comments on commit ea95dff

Please sign in to comment.