Skip to content

Commit

Permalink
If we remove an item from the "scan session" list, it should also rem…
Browse files Browse the repository at this point in the history
…ove it from the carousel (#4499)
  • Loading branch information
g123k authored Aug 9, 2023
1 parent eae3602 commit 44ea0f5
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -417,6 +418,12 @@ class _ProductListPageState extends State<ProductListPage>
if (removed) {
await DaoProductList(localDatabase).put(productList);
removedFromSelectedBarcodes = _selectedBarcodes.remove(barcode);

if (productList.listType == ProductListType.SCAN_SESSION &&
mounted) {
context.read<ContinuousScanModel>().removeBarcode(barcode);
}

setState(() => barcodes.removeAt(index));
}
if (!mounted) {
Expand Down

0 comments on commit 44ea0f5

Please sign in to comment.