From 54cf7f7cd638a866325c8b8d59f793e83e7e6398 Mon Sep 17 00:00:00 2001 From: monsieurtanuki Date: Thu, 26 Sep 2024 16:22:27 +0200 Subject: [PATCH] fix: 5570 - no nutriscore ecoscore for non-food products Impacted files: * `product_incomplete_card.dart`: minor padding fix * `smooth_product_card_found.dart`: no display of "incomplete product button" for non-food products --- .../product_cards/smooth_product_card_found.dart | 11 ++++++----- .../lib/pages/product/product_incomplete_card.dart | 4 ++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart index 6fa2c4f6947..cf201e5ab75 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart @@ -140,12 +140,13 @@ class SmoothProductCardFound extends StatelessWidget { padding: EdgeInsetsDirectional.only(start: VERY_SMALL_SPACE), ), - Padding( - padding: const EdgeInsets.all(VERY_SMALL_SPACE), - child: Column( - children: scores, + if (scores.isNotEmpty) + Padding( + padding: const EdgeInsets.all(VERY_SMALL_SPACE), + child: Column( + children: scores, + ), ), - ), ], ), ), diff --git a/packages/smooth_app/lib/pages/product/product_incomplete_card.dart b/packages/smooth_app/lib/pages/product/product_incomplete_card.dart index c60c7897639..9b9468f4029 100644 --- a/packages/smooth_app/lib/pages/product/product_incomplete_card.dart +++ b/packages/smooth_app/lib/pages/product/product_incomplete_card.dart @@ -21,6 +21,10 @@ class ProductIncompleteCard extends StatelessWidget { final bool isLoggedInMandatory; static bool isProductIncomplete(final Product product) { + if (product.productType != null && + product.productType != ProductType.food) { + return false; + } bool checkScores = true; if (_isNutriscoreNotApplicable(product)) { AnalyticsHelper.trackEvent(