Skip to content

Commit

Permalink
Merge branch 'develop' into feat/5700
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki authored Oct 20, 2024
2 parents c5dcf0b + 3185c72 commit a30f332
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class KnowledgePanelActionCard extends StatelessWidget {
);
}
if (kpAction == KnowledgePanelAction.addNutritionFacts) {
return AddNutritionButton(product);
if (AddNutritionButton.acceptsNutritionFacts(product)) {
return AddNutritionButton(product);
}
}
Logs.e('unhandled knowledge panel action: $action');
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class KnowledgePanelsBuilder {
ProductState.NUTRITION_FACTS_COMPLETED.toBeCompletedTag) ??
false;
if (nutritionAddOrUpdate) {
children.add(AddNutritionButton(product));
if (AddNutritionButton.acceptsNutritionFacts(product)) {
children.add(AddNutritionButton(product));
}
}

final bool needEditIngredients = context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class AddNutritionButton extends StatelessWidget {

final Product product;

static bool acceptsNutritionFacts(final Product product) =>
product.productType != ProductType.product &&
product.productType != ProductType.beauty;

@override
Widget build(BuildContext context) => addPanelButton(
AppLocalizations.of(context).score_add_missing_nutrition_facts,
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1853,4 +1853,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.5.3 <4.0.0"
flutter: ">=3.22.0"
flutter: ">=3.24.0"

0 comments on commit a30f332

Please sign in to comment.