Skip to content

Commit 18780f5

Browse files
fix: 7101 - nutripatrol now using flavor instead of product type (#7120)
1 parent 9e57934 commit 18780f5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_action_card.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class KnowledgePanelActionCard extends StatelessWidget {
8888
'https://nutripatrol.openfoodfacts.org/flag/product/'
8989
'?barcode=${product.barcode}'
9090
'&source=mobile'
91-
'&flavor=${product.productType?.offTag}',
91+
'&flavor=${product.productType?.flavor.offTag}',
9292
),
9393
);
9494
}
@@ -143,3 +143,13 @@ class KnowledgePanelActionCard extends StatelessWidget {
143143
properties.add(IterableProperty<String>('actions', element.actions));
144144
}
145145
}
146+
147+
// TODO(monsieurtanuki): move code to off-dart
148+
extension ProductTypeFlavorExtension on ProductType {
149+
Flavor get flavor => switch (this) {
150+
ProductType.food => Flavor.openFoodFacts,
151+
ProductType.beauty => Flavor.openBeautyFacts,
152+
ProductType.petFood => Flavor.openPetFoodFacts,
153+
ProductType.product => Flavor.openProductFacts,
154+
};
155+
}

0 commit comments

Comments
 (0)