Skip to content

Commit

Permalink
feat: #1377 - reextract ingredients (#1644)
Browse files Browse the repository at this point in the history
* feat: #1377 - display and re-extract ingredients
  • Loading branch information
cli1005 authored Apr 27, 2022
1 parent 3af05bd commit a88ac6d
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ import 'package:smooth_app/pages/user_preferences_dev_mode.dart';
///
/// Panels display large data like all health data or environment data.
class KnowledgePanelsBuilder {
const KnowledgePanelsBuilder({this.setState});
const KnowledgePanelsBuilder({
this.setState,
this.refreshProductCallback,
});

/// Would for instance refresh the product page.
final VoidCallback? setState;

/// Callback to refresh the product when necessary.
final Function(BuildContext)? refreshProductCallback;

/// Builds all panels.
///
/// Typical use case: product page.
Expand Down Expand Up @@ -140,12 +146,12 @@ class KnowledgePanelsBuilder {
knowledgePanelElementWidgets.add(
addPanelButton(
appLocalizations.score_add_missing_ingredients,
onPressed: () async => Navigator.push<Widget>(
onPressed: () async => Navigator.push<bool>(
context,
MaterialPageRoute<Widget>(
MaterialPageRoute<bool>(
builder: (BuildContext context) => EditIngredientsPage(
product: product,
imageIngredientsUrl: product.imageIngredientsUrl,
refreshProductCallback: refreshProductCallback,
),
),
),
Expand Down
1 change: 1 addition & 0 deletions packages/smooth_app/lib/database/product_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ abstract class ProductQuery {
ProductField.NUTRIMENT_ENERGY_UNIT,
ProductField.ADDITIVES,
ProductField.INGREDIENTS_ANALYSIS_TAGS,
ProductField.INGREDIENTS_TEXT,
ProductField.LABELS_TAGS,
ProductField.LABELS_TAGS_IN_LANGUAGES,
ProductField.ENVIRONMENT_IMPACT_LEVELS,
Expand Down
10 changes: 9 additions & 1 deletion packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,14 @@
"completed_basic_details_btn_text": "Complete basic details",
"not_implemented_snackbar_text": "Not implemented yet",
"category_picker_page_appbar_text": "Categories",
"edit_ingredients_extrait_ingredients_btn_text": "Extract ingredients",
"@edit_ingredients_extrait_ingredients_btn_text": {
"description": "Ingredients edition - Extract ingredients"
},
"edit_ingredients_refresh_photo_btn_text": "Refresh photo",
"@edit_ingredients_refresh_photo_btn_text": {
"description": "Ingredients edition - Refresh photo"
},
"user_list_dialog_new_title": "New list of products",
"@user_list_dialog_new_title": {
"description": "Title of the 'new user list' dialog"
Expand Down Expand Up @@ -881,4 +889,4 @@
"@user_list_name_error_same": {
"description": "Validation error about the renamed name that is the same as the initial list name"
}
}
}
Loading

0 comments on commit a88ac6d

Please sign in to comment.