diff --git a/packages/smooth_app/assets/onboarding/sample_product_data.json b/packages/smooth_app/assets/onboarding/sample_product_data.json
index 98141189256..39f5711d8a9 100644
--- a/packages/smooth_app/assets/onboarding/sample_product_data.json
+++ b/packages/smooth_app/assets/onboarding/sample_product_data.json
@@ -191,7 +191,7 @@
"id": "vegan",
"match": 100,
"name": "Vegan",
- "panel_id": "ingredients_analysis_en-vegan",
+ "panel_id": "ingredients_analysis_en:vegan",
"status": "known",
"title": "Vegan"
}, {
@@ -200,7 +200,7 @@
"id": "vegetarian",
"match": 100,
"name": "Vegetarian",
- "panel_id": "ingredients_analysis_en-vegetarian",
+ "panel_id": "ingredients_analysis_en:vegetarian",
"status": "known",
"title": "Vegetarian"
}, {
@@ -209,7 +209,7 @@
"id": "palm_oil_free",
"match": 100,
"name": "Palm oil free",
- "panel_id": "ingredients_analysis_en-palm-oil-free",
+ "panel_id": "ingredients_analysis_en:palm-oil-free",
"status": "known",
"title": "Palm oil free"
}],
@@ -1118,7 +1118,7 @@
"elements": [{
"element_type": "panel_group",
"panel_group_element": {
- "panel_ids": ["nutriscore", "physical_activities", "nutrition_facts_table"],
+ "panel_ids": ["nutriscore", "nutrition_facts_table"],
"title": ""
}
}, {
@@ -1136,7 +1136,7 @@
}, {
"element_type": "panel_group",
"panel_group_element": {
- "panel_ids": ["ingredients_analysis"],
+ "panel_ids": ["ingredients_analysis", "ingredients_analysis_details"],
"title": "Ingredients analysis"
}
}],
@@ -1159,10 +1159,16 @@
"lc": "en"
}
}],
- "expanded": true,
+ "evaluation": "unknown",
+ "expand_for": "large",
+ "expanded": false,
"level": "info",
- "topics": ["health"],
- "type": "inline"
+ "title_element": {
+ "icon_color_from_evaluation": true,
+ "icon_url": "https://static.openfoodfacts.org/images/icons/dist/ingredients.svg",
+ "title": "7 ingredients"
+ },
+ "topics": ["health"]
},
"ingredients_analysis": {
"elements": [{
@@ -1191,11 +1197,39 @@
"topics": ["health"],
"type": "inline"
},
+ "ingredients_analysis_details": {
+ "elements": [{
+ "element_type": "text",
+ "text_element": {
+ "html": "Butternut squash 50%, water, carrots 10%, sweet potato, leeks, potatoes, salt"
+ }
+ }, {
+ "element_type": "text",
+ "text_element": {
+ "html": "
\n- Butternut squash -> en:butternut-squash - vegan: yes - vegetarian: yes - percent_min: 50 - percent: 50 - percent_max: 50
\n- water -> en:water - vegan: yes - vegetarian: yes - percent_min: 10 - percent_max: 45
\n- carrots -> en:carrot - vegan: yes - vegetarian: yes - percent_min: 10 - percent: 10 - percent_max: 10
\n- sweet potato -> en:sweet-potato - vegan: yes - vegetarian: yes - percent_min: 0 - percent_max: 10
\n- leeks -> en:leek - vegan: yes - vegetarian: yes - percent_min: 0 - percent_max: 10
\n- potatoes -> en:potato - vegan: yes - vegetarian: yes - percent_min: 0 - percent_max: 10
\n- salt -> en:salt - vegan: yes - vegetarian: yes - percent_min: 0 - percent_max: 8
\n
\n"
+ }
+ }, {
+ "element_type": "text",
+ "text_element": {
+ "html": ""
+ }
+ }],
+ "evaluation": "unknown",
+ "level": "info",
+ "size": "small",
+ "title_element": {
+ "icon_color_from_evaluation": true,
+ "icon_size": "small",
+ "icon_url": "https://static.openfoodfacts.org/images/icons/dist/off-magnifying-glass.svg",
+ "title": "Details of the analysis of the ingredients"
+ },
+ "topics": ["health"]
+ },
"ingredients_analysis_en:palm-oil-free": {
"elements": [{
"element_type": "text",
"text_element": {
- "html": "\n \n No ingredients containing palm oil detected\n \n \n \n \n ",
+ "html": "\n \n No ingredients containing palm oil detected\n \n \n ",
"type": "summary"
}
}],
@@ -1214,7 +1248,7 @@
"elements": [{
"element_type": "text",
"text_element": {
- "html": "\n \n No non-vegan ingredients\n \n \n \n \n ",
+ "html": "\n \n No non-vegan ingredients\n \n \n ",
"type": "summary"
}
}],
@@ -1233,7 +1267,7 @@
"elements": [{
"element_type": "text",
"text_element": {
- "html": "\n \n No non-vegetarian ingredients detected\n \n \n \n \n ",
+ "html": "\n \n No non-vegetarian ingredients detected\n \n \n ",
"type": "summary"
}
}],
@@ -1294,7 +1328,7 @@
"elements": [{
"element_type": "text",
"text_element": {
- "html": "Warning: the amount of fruits, vegetables and nuts is not specified on the label, it was estimated from the list of ingredients: 60%\n ",
+ "html": "Warning: the amount of fruits, vegetables and nuts is not specified on the label, it was estimated from the list of ingredients: 60\n ",
"type": "warning"
}
}, {
@@ -1358,7 +1392,7 @@
"text": "0.5 g"
}, {
"evaluation": "good",
- "text": "-68%"
+ "text": "-67%"
}]
}, {
"values": [{
@@ -1369,7 +1403,7 @@
"text": "0.2 g"
}, {
"evaluation": "good",
- "text": "-35%"
+ "text": "-28%"
}]
}, {
"values": [{
@@ -1380,7 +1414,7 @@
"text": "0.4 g"
}, {
"evaluation": "good",
- "text": "-33%"
+ "text": "-34%"
}]
}, {
"values": [{
@@ -1401,7 +1435,7 @@
"text": "3 g"
}, {
"evaluation": "good",
- "text": "+134%"
+ "text": "+131%"
}]
}, {
"values": [{
@@ -1423,7 +1457,7 @@
"text": "1 g"
}, {
"evaluation": "bad",
- "text": "-34%"
+ "text": "-36%"
}]
}, {
"values": [{
@@ -1439,10 +1473,16 @@
"title": "Nutrition facts"
}
}],
- "expanded": true,
+ "evaluation": "unknown",
+ "expand_for": "large",
+ "expanded": false,
"level": "info",
- "topics": ["health"],
- "type": "inline"
+ "title_element": {
+ "icon_color_from_evaluation": true,
+ "icon_url": "https://static.openfoodfacts.org/images/icons/dist/scale-balance.svg",
+ "title": "Nutrition facts"
+ },
+ "topics": ["health"]
},
"origins_of_ingredients": {
"elements": [{
@@ -1508,59 +1548,6 @@
},
"topics": ["environment"]
},
- "physical_activities": {
- "elements": [{
- "element_type": "text",
- "text_element": {
- "evaluation": "good",
- "html": "\n Swimming: 4 min \n ",
- "icon_alt": "Swimming",
- "icon_color_from_evaluation": true,
- "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-swimming.svg",
- "type": "summary",
- "valign": "middle"
- }
- }, {
- "element_type": "text",
- "text_element": {
- "evaluation": "good",
- "html": "\n Bicycling: 3 min \n ",
- "icon_alt": "Bicycling",
- "icon_color_from_evaluation": true,
- "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-bicycling.svg",
- "type": "summary",
- "valign": "middle"
- }
- }, {
- "element_type": "text",
- "text_element": {
- "evaluation": "good",
- "html": "\n Running: 2 min \n ",
- "icon_alt": "Running",
- "icon_color_from_evaluation": true,
- "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-running.svg",
- "type": "summary",
- "valign": "middle"
- }
- }, {
- "element_type": "text",
- "text_element": {
- "html": "\n Energy expenditure for a person weighting 70 kg / 154 lb
\n ",
- "icon_color_from_evaluation": true,
- "type": "summary"
- }
- }],
- "evaluation": "good",
- "expanded": false,
- "level": "info",
- "title_element": {
- "icon_color_from_evaluation": true,
- "icon_url": "https://static.openfoodfacts.org/images/icons/dist/activity-walking.svg",
- "subtitle": "Equal to walking 7 minutes or 700 steps",
- "title": "120 kJ per 100g"
- },
- "topics": ["health"]
- },
"root": {
"elements": [{
"element_type": "panel",
diff --git a/packages/smooth_app/lib/data_models/onboarding_loader.dart b/packages/smooth_app/lib/data_models/onboarding_loader.dart
index 0d9315bbb85..04d1ae94178 100644
--- a/packages/smooth_app/lib/data_models/onboarding_loader.dart
+++ b/packages/smooth_app/lib/data_models/onboarding_loader.dart
@@ -12,6 +12,8 @@ class OnboardingLoader {
final LocalDatabase _localDatabase;
/// To be called first thing when we click on "next" during onboarding.
+ ///
+ /// The [page] parameter refers to the current page (before the next).
Future runAtNextTime(
final OnboardingPage page,
final BuildContext context,
@@ -44,10 +46,14 @@ class OnboardingLoader {
case OnboardingPage.HEALTH_CARD_EXAMPLE:
case OnboardingPage.ECO_CARD_EXAMPLE:
case OnboardingPage.PREFERENCES_PAGE:
+ // nothing special to do
+ return;
case OnboardingPage.CONSENT_PAGE:
+ // that was the last page of onboarding: after that, we clean up
+ await _unloadData();
return;
case OnboardingPage.ONBOARDING_COMPLETE:
- await _unloadData();
+ // will never happen: we never click "next" on a "complete" page
return;
}
}