From 44ea0f5521c91fdc5c73dfb1ddf7cd67dd2d1bd2 Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Wed, 9 Aug 2023 16:16:40 +0200 Subject: [PATCH] If we remove an item from the "scan session" list, it should also remove it from the carousel (#4499) --- .../lib/pages/product/common/product_list_page.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/smooth_app/lib/pages/product/common/product_list_page.dart b/packages/smooth_app/lib/pages/product/common/product_list_page.dart index 980f6b8410c..42906f034c8 100644 --- a/packages/smooth_app/lib/pages/product/common/product_list_page.dart +++ b/packages/smooth_app/lib/pages/product/common/product_list_page.dart @@ -6,6 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:matomo_tracker/matomo_tracker.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:provider/provider.dart'; +import 'package:smooth_app/data_models/continuous_scan_model.dart'; import 'package:smooth_app/data_models/product_list.dart'; import 'package:smooth_app/data_models/up_to_date_product_list_mixin.dart'; import 'package:smooth_app/database/dao_product.dart'; @@ -417,6 +418,12 @@ class _ProductListPageState extends State if (removed) { await DaoProductList(localDatabase).put(productList); removedFromSelectedBarcodes = _selectedBarcodes.remove(barcode); + + if (productList.listType == ProductListType.SCAN_SESSION && + mounted) { + context.read().removeBarcode(barcode); + } + setState(() => barcodes.removeAt(index)); } if (!mounted) {