Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #2501 - added "origins" in edit product page #2571

Merged
merged 3 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,14 @@
"@edit_product_form_item_stores_hint": {
"description": "Product edition - Stores - input textfield hint"
},
"edit_product_form_item_origins_title": "Origins",
"@edit_product_form_item_origins_title": {
"description": "Product edition - Origins - Title"
},
"edit_product_form_item_origins_hint": "Spain, Beef from Argentina, The soy does not come from the European union",
"@edit_product_form_item_origins_hint": {
"description": "Product edition - Origins - input textfield hint"
},
"edit_product_form_item_countries_title": "Country",
"@edit_product_form_item_countries_title": {
"description": "Product edition - Countries - Title"
Expand Down
8 changes: 8 additions & 0 deletions packages/smooth_app/lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,14 @@
"@edit_product_form_item_stores_hint": {
"description": "Product edition - Stores - input textfield hint"
},
"edit_product_form_item_origins_title": "Origines",
"@edit_product_form_item_origins_title": {
"description": "Product edition - Origins - Title"
},
"edit_product_form_item_origins_hint": "Espagne",
"@edit_product_form_item_origins_hint": {
"description": "Product edition - Origins - input textfield hint"
},
"edit_product_form_item_countries_title": "Pays",
"@edit_product_form_item_countries_title": {
"description": "Product edition - Countries - Title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class _EditProductPageState extends State<EditProductPage> {
},
),
_getSimpleListTileItem(SimpleInputPageStoreHelper()),
_getSimpleListTileItem(SimpleInputPageOriginHelper()),
_getSimpleListTileItem(SimpleInputPageEmbCodeHelper()),
_getSimpleListTileItem(SimpleInputPageCountryHelper()),
_getSimpleListTileItem(SimpleInputPageCategoryHelper()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,30 @@ class SimpleInputPageStoreHelper extends AbstractSimpleInputPageHelper {
Widget? getIcon() => const Icon(Icons.shopping_cart);
}

/// Implementation for "Origins" of an [AbstractSimpleInputPageHelper].
class SimpleInputPageOriginHelper extends AbstractSimpleInputPageHelper {
@override
List<String> initTerms() => splitString(product.origins);

@override
void changeProduct(final Product changedProduct) =>
changedProduct.origins = terms.join(_separator);

@override
String getTitle(final AppLocalizations appLocalizations) =>
appLocalizations.edit_product_form_item_origins_title;

@override
String getAddHint(final AppLocalizations appLocalizations) =>
appLocalizations.edit_product_form_item_origins_hint;

@override
TagType? getTagType() => null;

@override
Widget? getIcon() => const Icon(Icons.travel_explore);
}

/// Implementation for "Emb Code" of an [AbstractSimpleInputPageHelper].
class SimpleInputPageEmbCodeHelper extends AbstractSimpleInputPageHelper {
@override
Expand Down
1 change: 1 addition & 0 deletions packages/smooth_app/lib/query/product_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,6 @@ abstract class ProductQuery {
ProductField.COUNTRIES_TAGS,
ProductField.COUNTRIES_TAGS_IN_LANGUAGES,
ProductField.EMB_CODES,
ProductField.ORIGINS,
];
}
2 changes: 1 addition & 1 deletion packages/smooth_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ packages:
name: openfoodfacts
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.0"
version: "1.22.0"
openfoodfacts_flutter_lints:
dependency: "direct dev"
description:
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
url: 'https://github.com/M123-dev/matomo-tracker.git'
ref: 'fix-event-sending'
modal_bottom_sheet: ^2.1.0
openfoodfacts: ^1.21.0
openfoodfacts: ^1.22.0
# openfoodfacts:
# path: ../../../openfoodfacts-dart
package_info_plus: ^1.4.2
Expand Down