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

[pull] develop from openfoodfacts:develop #94

Closed
wants to merge 4 commits into from
Closed
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
3 changes: 2 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ History:
⚙️🥗 Food preferences:
- changed-files:
- any-glob-to-any-file: 'packages/smooth_app/lib/widgets/attribute_button.dart'

- any-glob-to-any-file: 'packages/smooth_app/lib/pages/preferences/user_preferences_attribute_group.dart'

🤗 Onboarding:
- changed-files:
- any-glob-to-any-file: 'packages/smooth_app/lib/pages/onboarding/**/*'
Expand Down
40 changes: 39 additions & 1 deletion packages/smooth_app/lib/generic_lib/widgets/smooth_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ class SmoothCardWithRoundedHeaderTop extends StatelessWidget {
painter: _SmoothCardWithRoundedHeaderBackgroundPainter(
color: color,
radius: borderRadius?.topRight ?? ROUNDED_RADIUS,
shadowElevation:
SmoothCardWithRoundedHeaderTopShadowProvider.of(context)
?.shadow ??
0.0,
),
child: Padding(
padding: titlePadding ??
Expand Down Expand Up @@ -282,6 +286,30 @@ class SmoothCardWithRoundedHeaderTop extends StatelessWidget {
}
}

class SmoothCardWithRoundedHeaderTopShadowProvider extends InheritedWidget {
const SmoothCardWithRoundedHeaderTopShadowProvider({
required this.shadow,
required super.child,
super.key,
});

final double shadow;

static SmoothCardWithRoundedHeaderTopShadowProvider? of(
BuildContext context) {
final SmoothCardWithRoundedHeaderTopShadowProvider? result =
context.dependOnInheritedWidgetOfExactType<
SmoothCardWithRoundedHeaderTopShadowProvider>();
return result;
}

@override
bool updateShouldNotify(
SmoothCardWithRoundedHeaderTopShadowProvider oldWidget) {
return oldWidget.shadow != shadow;
}
}

class SmoothCardWithRoundedHeaderBody extends StatelessWidget {
const SmoothCardWithRoundedHeaderBody({
required this.child,
Expand Down Expand Up @@ -320,10 +348,12 @@ class _SmoothCardWithRoundedHeaderBackgroundPainter extends CustomPainter {
_SmoothCardWithRoundedHeaderBackgroundPainter({
required Color color,
required this.radius,
required this.shadowElevation,
}) : _paint = Paint()..color = color;

final Radius radius;
final Paint _paint;
final double shadowElevation;

@override
void paint(Canvas canvas, Size size) {
Expand Down Expand Up @@ -355,14 +385,22 @@ class _SmoothCardWithRoundedHeaderBackgroundPainter extends CustomPainter {
)
..close();

if (shadowElevation > 0.0) {
canvas.drawShadow(
path,
Colors.black.withValues(alpha: shadowElevation),
2.0,
false,
);
}
canvas.drawPath(path, _paint);
}

@override
bool shouldRepaint(
_SmoothCardWithRoundedHeaderBackgroundPainter oldDelegate,
) =>
false;
shadowElevation != oldDelegate.shadowElevation;

@override
bool shouldRebuildSemantics(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:sliver_tools/sliver_tools.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/widgets/smooth_card.dart';
import 'package:smooth_app/helpers/num_utils.dart';
import 'package:smooth_app/widgets/widget_height.dart';

class SliverCardWithRoundedHeader extends StatefulWidget {
Expand Down Expand Up @@ -125,7 +126,10 @@ class _SliverCardWithRoundedHeaderDelegate
width: double.infinity,
),
),
child,
SmoothCardWithRoundedHeaderTopShadowProvider(
shadow: shrinkOffset.progressAndClamp(0.0, 30.0, 1.0),
child: child,
),
],
);
}
Expand Down
52 changes: 48 additions & 4 deletions packages/smooth_app/lib/l10n/app_aa.arb
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@
"@nutrition_facts_photo": {
"description": "Button label: For adding a picture of the nutrition facts of a product"
},
"nutrition_facts_editing_title": "Edit Nutrition Facts",
"@nutrition_facts_editing_title": {
"description": "Title of the button where users can edit the nutrition facts of a product"
},
"packaging_information": "Packaging information",
"@packaging_information": {
"description": "Button label: For adding a picture of the packaging of a product"
Expand Down Expand Up @@ -767,18 +771,39 @@
"score_add_missing_product_brands": "Add missing product brands",
"score_update_nutrition_facts": "Update nutrition facts",
"nutrition_page_title": "Nutrition Facts",
"nutrition_page_unspecified": "Nutrition facts are not specified on the product",
"nutrition_page_nutritional_info_title": "Nutritional information",
"nutrition_page_nutritional_info_label": "Values specified on the product:",
"nutrition_page_nutritional_info_value_positive": "Yes",
"nutrition_page_nutritional_info_value_negative": "No",
"nutrition_page_nutritional_info_open_photo": "Open photo",
"nutrition_page_nutritional_info_explanation": "TODO",
"@nutrition_page_nutritional_info_explanation": {
"description": "DO NOT TRANSLATE Text to explain when we should set the toggle to off (no nutrition facts)"
},
"nutrition_page_serving_type_label": "Nutritional values:",
"@nutrition_page_serving_type_label": {
"description": "Label to let the user choose between per 100g or per serving"
},
"nutrition_page_per_100g": "per 100g",
"nutrition_page_per_serving": "per serving",
"nutrition_page_add_nutrient": "Add a nutrient",
"nutrition_page_serving_size": "Serving size",
"nutrition_page_serving_size_hint": "Input a serving size (eg: 100g)",
"nutrition_page_serving_size_explanation": "TODO",
"@nutrition_page_serving_size_explanation": {
"description": "DO NOT TRANSLATE Text to explain what to input in the serving size"
},
"nutrition_page_invalid_number": "Invalid number",
"nutrition_page_update_running": "Updating the product on the server…",
"nutrition_page_update_done": "Product updated!",
"nutrition_page_take_serving_size_from_product_quantity": "Use the product quantity as serving size",
"@nutrition_page_take_serving_size_from_product_quantity": {
"description": "Button label: Use the product quantity as serving size (nutrition page)"
},
"nutrition_page_photo_error": "Unable to load the photo",
"@nutrition_page_photo_error": {
"description": "Error message when the nutrition facts photo can't be loaded"
},
"more_photos": "More interesting photos",
"@more_photos": {},
"view_more_photo_button": "View all existing photos for this product",
Expand Down Expand Up @@ -865,14 +890,20 @@
},
"product_image_details_contributor": "Contributor",
"@product_image_details_contributor": {
"description": "The name of the contributor (and also the owner field) who uploaded the image"
"description": "The name of the contributor who uploaded the image"
},
"product_image_details_contributor_producer": "Contributor (producer)",
"@product_image_details_contributor_producer": {
"description": "The name of the contributor (and also the owner field) who uploaded the image"
},
"product_image_details_date": "Date",
"@product_image_details_date": {
"description": "Text to indicate the date of the image is unknown"
"description": "Text to indicate the date of the image"
},
"product_image_details_date_unknown": "Unknown",
"@product_image_details_date_unknown": {
"description": "Text to indicate the date of the image is unknown"
},
"homepage_main_card_logo_description": "Welcome to Open Food Facts",
"@homepage_main_card_logo_description": {
"description": "Description for accessibility of the Open Food Facts logo on the homepage"
Expand Down Expand Up @@ -1677,6 +1708,10 @@
"@edit_product_form_item_nutrition_facts_subtitle": {
"description": "Product edition - Nutrition facts - SubTitle"
},
"edit_product_form_item_nutrition_facts_explanation": "TODO",
"@edit_product_form_item_nutrition_facts_explanation": {
"description": "DO NOT TRANSLATE Text to explain what to input in nutrition facts"
},
"edit_product_form_save": "Edit",
"@edit_product_form_save": {
"description": "Product edition - Nutrition facts - Save button"
Expand Down Expand Up @@ -1705,6 +1740,10 @@
"@product_field_website_title": {
"description": "Title of a product field: website"
},
"origins_editing_title": "Edit Origins",
"@origins_editing_title": {
"description": "Title of the button where users can edit the origins of a product"
},
"completed_basic_details_btn_text": "Complete basic details",
"not_implemented_snackbar_text": "Not implemented yet",
"category_picker_page_appbar_text": "Categories",
Expand Down Expand Up @@ -2227,8 +2266,13 @@
"prices_proof_mandatory": "You need to select a proof!",
"prices_add_validation_error": "Validation error",
"prices_privacy_warning_title": "Privacy warning",
"prices_privacy_warning_message": "Prices will be public, along with the store they refer to.\nThat might allow people who know about your Open Food Facts pseudonym to:\n* infer in which area you live\n* know what you are buying\nIf you are uneasy with that, please change your pseudonym, or create a new Open Food Facts account and log into the app with it.",
"prices_unknown_product": "Unknown product",
"prices_privacy_warning_main_message": "Prices **will be public**, along with the store they refer to.\n\nThat might allow people who know about your Open Food Facts pseudonym to:\n",
"prices_privacy_warning_message_bullet_1": "Infer in which area you live",
"prices_privacy_warning_message_bullet_2": "Know what you are buying",
"prices_privacy_warning_sub_message": "If you are uneasy with that, please change your pseudonym, or create a new Open Food Facts account and log into the app with it.",
"i_refuse": "I refuse",
"i_accept": "I accept",
"prices_currency_change_proposal_title": "Change the currency?",
"prices_currency_change_proposal_message": "Your current currency is **{currency}**. Would you like to change it to **{newCurrency}**?",
"@prices_currency_change_proposal_message": {
Expand Down
52 changes: 48 additions & 4 deletions packages/smooth_app/lib/l10n/app_ak.arb
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@
"@nutrition_facts_photo": {
"description": "Button label: For adding a picture of the nutrition facts of a product"
},
"nutrition_facts_editing_title": "Edit Nutrition Facts",
"@nutrition_facts_editing_title": {
"description": "Title of the button where users can edit the nutrition facts of a product"
},
"packaging_information": "Packaging information",
"@packaging_information": {
"description": "Button label: For adding a picture of the packaging of a product"
Expand Down Expand Up @@ -767,18 +771,39 @@
"score_add_missing_product_brands": "Add missing product brands",
"score_update_nutrition_facts": "Update nutrition facts",
"nutrition_page_title": "Nutrition Facts",
"nutrition_page_unspecified": "Nutrition facts are not specified on the product",
"nutrition_page_nutritional_info_title": "Nutritional information",
"nutrition_page_nutritional_info_label": "Values specified on the product:",
"nutrition_page_nutritional_info_value_positive": "Yes",
"nutrition_page_nutritional_info_value_negative": "No",
"nutrition_page_nutritional_info_open_photo": "Open photo",
"nutrition_page_nutritional_info_explanation": "TODO",
"@nutrition_page_nutritional_info_explanation": {
"description": "DO NOT TRANSLATE Text to explain when we should set the toggle to off (no nutrition facts)"
},
"nutrition_page_serving_type_label": "Nutritional values:",
"@nutrition_page_serving_type_label": {
"description": "Label to let the user choose between per 100g or per serving"
},
"nutrition_page_per_100g": "per 100g",
"nutrition_page_per_serving": "per serving",
"nutrition_page_add_nutrient": "Add a nutrient",
"nutrition_page_serving_size": "Serving size",
"nutrition_page_serving_size_hint": "Input a serving size (eg: 100g)",
"nutrition_page_serving_size_explanation": "TODO",
"@nutrition_page_serving_size_explanation": {
"description": "DO NOT TRANSLATE Text to explain what to input in the serving size"
},
"nutrition_page_invalid_number": "Invalid number",
"nutrition_page_update_running": "Updating the product on the server…",
"nutrition_page_update_done": "Product updated!",
"nutrition_page_take_serving_size_from_product_quantity": "Use the product quantity as serving size",
"@nutrition_page_take_serving_size_from_product_quantity": {
"description": "Button label: Use the product quantity as serving size (nutrition page)"
},
"nutrition_page_photo_error": "Unable to load the photo",
"@nutrition_page_photo_error": {
"description": "Error message when the nutrition facts photo can't be loaded"
},
"more_photos": "More interesting photos",
"@more_photos": {},
"view_more_photo_button": "View all existing photos for this product",
Expand Down Expand Up @@ -865,14 +890,20 @@
},
"product_image_details_contributor": "Contributor",
"@product_image_details_contributor": {
"description": "The name of the contributor (and also the owner field) who uploaded the image"
"description": "The name of the contributor who uploaded the image"
},
"product_image_details_contributor_producer": "Contributor (producer)",
"@product_image_details_contributor_producer": {
"description": "The name of the contributor (and also the owner field) who uploaded the image"
},
"product_image_details_date": "Date",
"@product_image_details_date": {
"description": "Text to indicate the date of the image is unknown"
"description": "Text to indicate the date of the image"
},
"product_image_details_date_unknown": "Unknown",
"@product_image_details_date_unknown": {
"description": "Text to indicate the date of the image is unknown"
},
"homepage_main_card_logo_description": "Welcome to Open Food Facts",
"@homepage_main_card_logo_description": {
"description": "Description for accessibility of the Open Food Facts logo on the homepage"
Expand Down Expand Up @@ -1677,6 +1708,10 @@
"@edit_product_form_item_nutrition_facts_subtitle": {
"description": "Product edition - Nutrition facts - SubTitle"
},
"edit_product_form_item_nutrition_facts_explanation": "TODO",
"@edit_product_form_item_nutrition_facts_explanation": {
"description": "DO NOT TRANSLATE Text to explain what to input in nutrition facts"
},
"edit_product_form_save": "Edit",
"@edit_product_form_save": {
"description": "Product edition - Nutrition facts - Save button"
Expand Down Expand Up @@ -1705,6 +1740,10 @@
"@product_field_website_title": {
"description": "Title of a product field: website"
},
"origins_editing_title": "Edit Origins",
"@origins_editing_title": {
"description": "Title of the button where users can edit the origins of a product"
},
"completed_basic_details_btn_text": "Complete basic details",
"not_implemented_snackbar_text": "Not implemented yet",
"category_picker_page_appbar_text": "Categories",
Expand Down Expand Up @@ -2227,8 +2266,13 @@
"prices_proof_mandatory": "You need to select a proof!",
"prices_add_validation_error": "Validation error",
"prices_privacy_warning_title": "Privacy warning",
"prices_privacy_warning_message": "Prices will be public, along with the store they refer to.\nThat might allow people who know about your Open Food Facts pseudonym to:\n* infer in which area you live\n* know what you are buying\nIf you are uneasy with that, please change your pseudonym, or create a new Open Food Facts account and log into the app with it.",
"prices_unknown_product": "Unknown product",
"prices_privacy_warning_main_message": "Prices **will be public**, along with the store they refer to.\n\nThat might allow people who know about your Open Food Facts pseudonym to:\n",
"prices_privacy_warning_message_bullet_1": "Infer in which area you live",
"prices_privacy_warning_message_bullet_2": "Know what you are buying",
"prices_privacy_warning_sub_message": "If you are uneasy with that, please change your pseudonym, or create a new Open Food Facts account and log into the app with it.",
"i_refuse": "I refuse",
"i_accept": "I accept",
"prices_currency_change_proposal_title": "Change the currency?",
"prices_currency_change_proposal_message": "Your current currency is **{currency}**. Would you like to change it to **{newCurrency}**?",
"@prices_currency_change_proposal_message": {
Expand Down
Loading
Loading