diff --git a/packages/smooth_app/assets/cache/nutriscore-a-new-de.svg b/packages/smooth_app/assets/cache/nutriscore-a-new-de.svg
new file mode 100644
index 00000000000..dd477c13d49
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-a-new-de.svg
@@ -0,0 +1,152 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-a-new-en.svg b/packages/smooth_app/assets/cache/nutriscore-a-new-en.svg
new file mode 100644
index 00000000000..7ff414602af
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-a-new-en.svg
@@ -0,0 +1,154 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-a-new-formula-en.svg b/packages/smooth_app/assets/cache/nutriscore-a-new-formula-en.svg
deleted file mode 100644
index 6516f55c498..00000000000
--- a/packages/smooth_app/assets/cache/nutriscore-a-new-formula-en.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/smooth_app/assets/cache/nutriscore-a-new-fr.svg b/packages/smooth_app/assets/cache/nutriscore-a-new-fr.svg
new file mode 100644
index 00000000000..98eadef0fd0
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-a-new-fr.svg
@@ -0,0 +1,150 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-a-new-lb.svg b/packages/smooth_app/assets/cache/nutriscore-a-new-lb.svg
new file mode 100644
index 00000000000..eccf6122864
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-a-new-lb.svg
@@ -0,0 +1,151 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-a-new-nl.svg b/packages/smooth_app/assets/cache/nutriscore-a-new-nl.svg
new file mode 100644
index 00000000000..2f42b5a3c33
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-a-new-nl.svg
@@ -0,0 +1,158 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-b-new-de.svg b/packages/smooth_app/assets/cache/nutriscore-b-new-de.svg
new file mode 100644
index 00000000000..526c9fd6563
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-b-new-de.svg
@@ -0,0 +1,87 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-b-new-en.svg b/packages/smooth_app/assets/cache/nutriscore-b-new-en.svg
new file mode 100644
index 00000000000..0b814f08a42
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-b-new-en.svg
@@ -0,0 +1,89 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-b-new-formula-en.svg b/packages/smooth_app/assets/cache/nutriscore-b-new-formula-en.svg
deleted file mode 100644
index f973754dc27..00000000000
--- a/packages/smooth_app/assets/cache/nutriscore-b-new-formula-en.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/smooth_app/assets/cache/nutriscore-b-new-fr.svg b/packages/smooth_app/assets/cache/nutriscore-b-new-fr.svg
new file mode 100644
index 00000000000..b69eecab2e6
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-b-new-fr.svg
@@ -0,0 +1,85 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-b-new-lb.svg b/packages/smooth_app/assets/cache/nutriscore-b-new-lb.svg
new file mode 100644
index 00000000000..400cb6cd1ea
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-b-new-lb.svg
@@ -0,0 +1,86 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-b-new-nl.svg b/packages/smooth_app/assets/cache/nutriscore-b-new-nl.svg
new file mode 100644
index 00000000000..da157bbb357
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-b-new-nl.svg
@@ -0,0 +1,93 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-c-new-de.svg b/packages/smooth_app/assets/cache/nutriscore-c-new-de.svg
new file mode 100644
index 00000000000..4c754b3b352
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-c-new-de.svg
@@ -0,0 +1,223 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-c-new-en.svg b/packages/smooth_app/assets/cache/nutriscore-c-new-en.svg
new file mode 100644
index 00000000000..ccdfce3d122
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-c-new-en.svg
@@ -0,0 +1,225 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-c-new-formula-en.svg b/packages/smooth_app/assets/cache/nutriscore-c-new-formula-en.svg
deleted file mode 100644
index 7e208163e3f..00000000000
--- a/packages/smooth_app/assets/cache/nutriscore-c-new-formula-en.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/smooth_app/assets/cache/nutriscore-c-new-fr.svg b/packages/smooth_app/assets/cache/nutriscore-c-new-fr.svg
new file mode 100644
index 00000000000..71587caf799
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-c-new-fr.svg
@@ -0,0 +1,221 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-c-new-lb.svg b/packages/smooth_app/assets/cache/nutriscore-c-new-lb.svg
new file mode 100644
index 00000000000..bbb3191232e
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-c-new-lb.svg
@@ -0,0 +1,222 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-c-new-nl.svg b/packages/smooth_app/assets/cache/nutriscore-c-new-nl.svg
new file mode 100644
index 00000000000..66e0cbd75e0
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-c-new-nl.svg
@@ -0,0 +1,229 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-d-new-de.svg b/packages/smooth_app/assets/cache/nutriscore-d-new-de.svg
new file mode 100644
index 00000000000..875a6a7a69f
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-d-new-de.svg
@@ -0,0 +1,91 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-d-new-en.svg b/packages/smooth_app/assets/cache/nutriscore-d-new-en.svg
new file mode 100644
index 00000000000..1ee2a792e94
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-d-new-en.svg
@@ -0,0 +1,93 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-d-new-formula-en.svg b/packages/smooth_app/assets/cache/nutriscore-d-new-formula-en.svg
deleted file mode 100644
index 8a0ff49d8cd..00000000000
--- a/packages/smooth_app/assets/cache/nutriscore-d-new-formula-en.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/smooth_app/assets/cache/nutriscore-d-new-fr.svg b/packages/smooth_app/assets/cache/nutriscore-d-new-fr.svg
new file mode 100644
index 00000000000..cbf15b2395d
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-d-new-fr.svg
@@ -0,0 +1,89 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-d-new-lb.svg b/packages/smooth_app/assets/cache/nutriscore-d-new-lb.svg
new file mode 100644
index 00000000000..9ecc130b830
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-d-new-lb.svg
@@ -0,0 +1,90 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-d-new-nl.svg b/packages/smooth_app/assets/cache/nutriscore-d-new-nl.svg
new file mode 100644
index 00000000000..649654c3cba
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-d-new-nl.svg
@@ -0,0 +1,97 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-e-new-de.svg b/packages/smooth_app/assets/cache/nutriscore-e-new-de.svg
new file mode 100644
index 00000000000..6d9bbce4d97
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-e-new-de.svg
@@ -0,0 +1,289 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-e-new-en.svg b/packages/smooth_app/assets/cache/nutriscore-e-new-en.svg
new file mode 100644
index 00000000000..7eecf5f2a66
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-e-new-en.svg
@@ -0,0 +1,291 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-e-new-formula-en.svg b/packages/smooth_app/assets/cache/nutriscore-e-new-formula-en.svg
deleted file mode 100644
index f6c74eda004..00000000000
--- a/packages/smooth_app/assets/cache/nutriscore-e-new-formula-en.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/smooth_app/assets/cache/nutriscore-e-new-fr.svg b/packages/smooth_app/assets/cache/nutriscore-e-new-fr.svg
new file mode 100644
index 00000000000..6d0dcc74a00
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-e-new-fr.svg
@@ -0,0 +1,287 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-e-new-lb.svg b/packages/smooth_app/assets/cache/nutriscore-e-new-lb.svg
new file mode 100644
index 00000000000..481d624a659
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-e-new-lb.svg
@@ -0,0 +1,288 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-e-new-nl.svg b/packages/smooth_app/assets/cache/nutriscore-e-new-nl.svg
new file mode 100644
index 00000000000..cfffd912cb9
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-e-new-nl.svg
@@ -0,0 +1,295 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-formula-en.svg b/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-de.svg
similarity index 100%
rename from packages/smooth_app/assets/cache/nutriscore-not-applicable-new-formula-en.svg
rename to packages/smooth_app/assets/cache/nutriscore-not-applicable-new-de.svg
diff --git a/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-en.svg b/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-en.svg
new file mode 100644
index 00000000000..bcb99574253
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-en.svg
@@ -0,0 +1,317 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-fr.svg b/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-fr.svg
new file mode 100644
index 00000000000..bcb99574253
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-fr.svg
@@ -0,0 +1,317 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-lb.svg b/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-lb.svg
new file mode 100644
index 00000000000..bcb99574253
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-lb.svg
@@ -0,0 +1,317 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-nl.svg b/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-nl.svg
new file mode 100644
index 00000000000..bcb99574253
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-not-applicable-new-nl.svg
@@ -0,0 +1,317 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-unknown-new-formula-en.svg b/packages/smooth_app/assets/cache/nutriscore-unknown-new-de.svg
similarity index 100%
rename from packages/smooth_app/assets/cache/nutriscore-unknown-new-formula-en.svg
rename to packages/smooth_app/assets/cache/nutriscore-unknown-new-de.svg
diff --git a/packages/smooth_app/assets/cache/nutriscore-unknown-new-en.svg b/packages/smooth_app/assets/cache/nutriscore-unknown-new-en.svg
new file mode 100644
index 00000000000..407614599c9
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-unknown-new-en.svg
@@ -0,0 +1,318 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-unknown-new-fr.svg b/packages/smooth_app/assets/cache/nutriscore-unknown-new-fr.svg
new file mode 100644
index 00000000000..407614599c9
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-unknown-new-fr.svg
@@ -0,0 +1,318 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-unknown-new-lb.svg b/packages/smooth_app/assets/cache/nutriscore-unknown-new-lb.svg
new file mode 100644
index 00000000000..407614599c9
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-unknown-new-lb.svg
@@ -0,0 +1,318 @@
+
diff --git a/packages/smooth_app/assets/cache/nutriscore-unknown-new-nl.svg b/packages/smooth_app/assets/cache/nutriscore-unknown-new-nl.svg
new file mode 100644
index 00000000000..407614599c9
--- /dev/null
+++ b/packages/smooth_app/assets/cache/nutriscore-unknown-new-nl.svg
@@ -0,0 +1,318 @@
+
diff --git a/packages/smooth_app/lib/cards/category_cards/svg_cache.dart b/packages/smooth_app/lib/cards/category_cards/svg_cache.dart
index 4d07818a8d7..44913c04033 100644
--- a/packages/smooth_app/lib/cards/category_cards/svg_cache.dart
+++ b/packages/smooth_app/lib/cards/category_cards/svg_cache.dart
@@ -67,7 +67,8 @@ class SvgCache extends AbstractCache {
static String? getSemanticsLabel(BuildContext context, String iconUrl) {
final AppLocalizations localizations = AppLocalizations.of(context);
- return switch (Uri.parse(iconUrl).pathSegments.last) {
+ final String fileName = Uri.parse(iconUrl).pathSegments.last;
+ return switch (fileName) {
'ecoscore-a.svg' => localizations.ecoscore_a,
'ecoscore-b.svg' => localizations.ecoscore_b,
'ecoscore-c.svg' => localizations.ecoscore_c,
@@ -80,14 +81,56 @@ class SvgCache extends AbstractCache {
'nova-group-3.svg' => localizations.nova_group_3,
'nova-group-4.svg' => localizations.nova_group_4,
'nova-group-unknown.svg' => localizations.nova_group_unknown,
- 'nutriscore-a.svg' => localizations.nutriscore_a,
- 'nutriscore-b.svg' => localizations.nutriscore_b,
- 'nutriscore-c.svg' => localizations.nutriscore_c,
- 'nutriscore-d.svg' => localizations.nutriscore_d,
- 'nutriscore-e.svg' => localizations.nutriscore_e,
- 'nutriscore-unknown.svg' => localizations.nutriscore_unknown,
- 'nutriscore-not-applicable.svg' => localizations.ecoscore_not_applicable,
+ String _ when fileName.startsWith('nutriscore-') =>
+ _extractNutriScore(localizations, fileName),
_ => null,
};
}
+
+ static String _extractNutriScore(
+ AppLocalizations localizations,
+ String fileName,
+ ) {
+ // Old NutriScore
+ if (fileName == 'nutriscore-a.svg') {
+ return localizations.nutriscore_a;
+ } else if (fileName == 'nutriscore-b.svg') {
+ return localizations.nutriscore_b;
+ } else if (fileName == 'nutriscore-c.svg') {
+ return localizations.nutriscore_c;
+ } else if (fileName == 'nutriscore-d.svg') {
+ return localizations.nutriscore_d;
+ } else if (fileName == 'nutriscore-e.svg') {
+ return localizations.nutriscore_e;
+ } else if (fileName == 'nutriscore-unknown.svg') {
+ return localizations.nutriscore_unknown;
+ } else if (fileName == 'nutriscore-not-applicable.svg') {
+ return localizations.nutriscore_not_applicable;
+ }
+
+ // NutriScore V2
+ if (fileName == 'nutriscore-unknown-') {
+ return localizations.nutriscore_unknown_new_formula;
+ } else if (fileName == 'nutriscore-not-applicable-') {
+ return localizations.nutriscore_not_applicable_new_formula;
+ } else {
+ final String? letter;
+
+ if (fileName.startsWith('nutriscore-a-new')) {
+ letter = 'A';
+ } else if (fileName.startsWith('nutriscore-b-new')) {
+ letter = 'B';
+ } else if (fileName.startsWith('nutriscore-c-new')) {
+ letter = 'C';
+ } else if (fileName.startsWith('nutriscore-d-new')) {
+ letter = 'D';
+ } else if (fileName.startsWith('nutriscore-e-new')) {
+ letter = 'E';
+ } else {
+ return localizations.nutriscore_unknown;
+ }
+
+ return localizations.nutriscore_new_formula(letter);
+ }
+ }
}
diff --git a/packages/smooth_app/lib/l10n/app_en.arb b/packages/smooth_app/lib/l10n/app_en.arb
index aa2a8d8dca3..f098449f139 100644
--- a/packages/smooth_app/lib/l10n/app_en.arb
+++ b/packages/smooth_app/lib/l10n/app_en.arb
@@ -2514,8 +2514,19 @@
"nutriscore_c": "Nutri-Score C",
"nutriscore_d": "Nutri-Score D",
"nutriscore_e": "Nutri-Score E",
+ "nutriscore_new_formula": "Nutri-Score {letter} (New calculation)",
+ "@nutriscore_new_formula": {
+ "description": "A generic string to define a Nutri-Score V2 with a letter [eg: \"Nutri-Score A (New calculation)\"]",
+ "placeholders": {
+ "letter": {
+ "type": "String"
+ }
+ }
+ },
"nutriscore_unknown": "Unknown Nutri-Score",
+ "nutriscore_unknown_new_formula": "Unknown Nutri-Score (New calculation)",
"nutriscore_not_applicable": "Nutri-Score is not applicable",
+ "nutriscore_not_applicable_new_formula": "Nutri-Score is not applicable (New calculation)",
"ecoscore_generic": "Eco-Score",
"ecoscore_a": "Eco-Score A",
"ecoscore_b": "Eco-Score B",
diff --git a/packages/smooth_app/lib/resources/app_animations.dart b/packages/smooth_app/lib/resources/app_animations.dart
index 43417402375..01d4df9e9eb 100644
--- a/packages/smooth_app/lib/resources/app_animations.dart
+++ b/packages/smooth_app/lib/resources/app_animations.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
import 'package:rive/rive.dart';
import 'package:smooth_app/services/smooth_services.dart';
@@ -421,23 +422,40 @@ class _NutriScoreAnimationState extends State {
@override
Widget build(BuildContext context) {
- return SizedBox.fromSize(
- size: widget.size ?? Size.fromHeight(IconTheme.of(context).size ?? 24.0),
- child: AspectRatio(
- aspectRatio: 176 / 94,
- child: RiveAnimation.asset(
- 'assets/animations/nutriscore.riv',
- artboard: 'Nutriscore',
- fit: BoxFit.contain,
- onInit: (Artboard artboard) {
- _controller = StateMachineController.fromArtboard(
- artboard,
- 'Nutriscore',
- );
-
- artboard.addController(_controller!);
- _changeNutriScoreState(widget.level);
- },
+ final AppLocalizations localizations = AppLocalizations.of(context);
+
+ return Semantics(
+ // TODO(g123k): Update with V2 once the animation is ready
+ label: switch (widget.level) {
+ 0 => localizations.nutriscore_a,
+ 1 => localizations.nutriscore_b,
+ 2 => localizations.nutriscore_c,
+ 3 => localizations.nutriscore_d,
+ 4 => localizations.nutriscore_e,
+ _ => localizations.nutriscore_unknown,
+ },
+ image: true,
+ child: SizedBox.fromSize(
+ size: widget.size ??
+ Size.fromHeight(
+ IconTheme.of(context).size ?? 24.0,
+ ),
+ child: AspectRatio(
+ aspectRatio: 176 / 94,
+ child: RiveAnimation.asset(
+ 'assets/animations/nutriscore.riv',
+ artboard: 'Nutriscore',
+ fit: BoxFit.contain,
+ onInit: (Artboard artboard) {
+ _controller = StateMachineController.fromArtboard(
+ artboard,
+ 'Nutriscore',
+ );
+
+ artboard.addController(_controller!);
+ _changeNutriScoreState(widget.level);
+ },
+ ),
),
),
);