Skip to content

Commit

Permalink
feat: 4551 - minor cosmetic changes on settings display (openfoodfact…
Browse files Browse the repository at this point in the history
…s#4589)

* feat: 4551 - minor cosmetic changes on settings display

Impacted files:
* `app_en.arb`: new "join the skill pool" label
* `user_preferences_connect.dart`: added dividers; changed the newsletter icon; same email icon everywhere
* `user_preferences_contribute.dart`: added "contribute" and a "join the pool" items; minor refactoring
* `user_preferences_faq.dart`: changed the "feedback" icon

* feat: 4551 - changed one icon

* feat: 4551 - smaller nutrient icon (from 2 to 1.5 = -25%)

* Update packages/smooth_app/lib/l10n/app_en.arb

---------

Co-authored-by: Pierre Slamich <[email protected]>
  • Loading branch information
monsieurtanuki and teolemon authored Aug 22, 2023
1 parent 36cd216 commit 8193cf1
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 18 deletions.
1 change: 1 addition & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@
"@contribute_translate_text": {},
"contribute_translate_text_2": "Translations is one of the key tasks of the project",
"@contribute_translate_text_2": {},
"contribute_join_skill_pool": "Contribute your skills to Open Food Facts. Join the skill pool!",
"contribute_share_header": "Share Open Food Facts with your friends",
"@contribute_share_header": {},
"contribute_share_content": "I wanted to let you know about the app I've been using, Open Food Facts, which allows you to get the health and environmental impacts of your food, in a personalized way. It works by scanning the barcodes on the packaging. Finally it's free, does not require registration, and you can even help increase the number of products decyphered. Here's the link to get it for your phone: https://openfoodfacts.app",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class UserPreferencesConnect extends AbstractUserPreferences {
url: 'https://blog.openfoodfacts.org',
leadingIconData: Icons.newspaper,
),
const Divider(),
_getListTile(
title: appLocalizations.support_via_forum,
url: 'https://forum.openfoodfacts.org/',
Expand All @@ -93,6 +94,7 @@ class UserPreferencesConnect extends AbstractUserPreferences {
url: 'https://slack.openfoodfacts.org/',
leadingIconData: Icons.chat,
),
const Divider(),
_getListTile(
title: appLocalizations.contact_title_pro_page,
url: ProductQuery.replaceSubdomain(
Expand All @@ -102,35 +104,37 @@ class UserPreferencesConnect extends AbstractUserPreferences {
),
_getListTile(
title: appLocalizations.contact_title_pro_email,
leadingIconData: Icons.drafts_outlined,
leadingIconData: Icons.drafts,
onTap: () async => _sendEmail(
recipient:
ProductQuery.getLanguage() == OpenFoodFactsLanguage.FRENCH
? '[email protected]'
: '[email protected]',
),
),
const Divider(),
_getListTile(
title: appLocalizations.contact_title_press_page,
url: ProductQuery.replaceSubdomain(
'https://world.openfoodfacts.org/press',
),
leadingIconData: CupertinoIcons.news,
leadingIconData: CupertinoIcons.news_solid,
),
_getListTile(
title: appLocalizations.contact_title_press_email,
leadingIconData: Icons.drafts_outlined,
leadingIconData: Icons.drafts,
onTap: () async => _sendEmail(
recipient:
ProductQuery.getLanguage() == OpenFoodFactsLanguage.FRENCH
? '[email protected]'
: '[email protected]',
),
),
const Divider(),
_getListTile(
title: appLocalizations.contact_title_newsletter,
url: 'https://link.openfoodfacts.org/newsletter-en',
leadingIconData: Icons.subscriptions_outlined,
leadingIconData: CupertinoIcons.news_solid,
),
_getListTile(
title: appLocalizations.support_via_email,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'package:smooth_app/pages/preferences/user_preferences_page.dart';
import 'package:smooth_app/pages/preferences/user_preferences_widgets.dart';
import 'package:smooth_app/pages/product/common/product_query_page_helper.dart';
import 'package:smooth_app/query/paged_to_be_completed_product_query.dart';
import 'package:smooth_app/query/product_query.dart';

/// Display of "Contribute" for the preferences page.
class UserPreferencesContribute extends AbstractUserPreferences {
Expand Down Expand Up @@ -58,39 +59,62 @@ class UserPreferencesContribute extends AbstractUserPreferences {
return <Widget>[
_getListTile(
'Hunger Games',
() => _hungerGames(),
() async => _hungerGames(),
Icons.games,
),
_getListTile(
appLocalizations.contribute_improve_header,
() => _contribute(),
() async => _contribute(),
Icons.data_saver_on,
),
_getListTile(
appLocalizations.contribute_sw_development,
() => _develop(),
() async => _develop(),
Icons.app_shortcut,
),
_getListTile(
appLocalizations.contribute_translate_header,
() => _translate(),
() async => _translate(),
Icons.translate,
),
_getListTile(
appLocalizations.how_to_contribute,
() async => LaunchUrlHelper.launchURL(
ProductQuery.replaceSubdomain(
'https://world.openfoodfacts.org/contribute',
),
false,
),
Icons.volunteer_activism_outlined,
externalLink: true,
),
_getListTile(
appLocalizations.contribute_join_skill_pool,
() async => LaunchUrlHelper.launchURL(
'https://docs.google.com/forms/d/e/1FAIpQLSfGHAn5KxW7ko3_GlDfQpVGKpPAMHMbDvY2IjtxfJSXxKJQ2A/viewform?usp=sf_link',
false,
),
Icons.group,
externalLink: true,
),
_getListTile(
appLocalizations.contribute_share_header,
() => _share(appLocalizations.contribute_share_content),
() async => _share(appLocalizations.contribute_share_content),
Icons.adaptive.share,
),
_getListTile(
appLocalizations.contribute_donate_header,
() => _donate(),
() async => LaunchUrlHelper.launchURL(
AppLocalizations.of(context).donate_url,
false,
),
Icons.volunteer_activism,
icon: UserPreferencesListTile.getTintedIcon(Icons.open_in_new, context),
externalLink: true,
),
_getListTile(
appLocalizations.contributors_label,
() => _contributors(),
() async => _contributors(),
Icons.emoji_people,
description: appLocalizations.contributors_description,
),
Expand Down Expand Up @@ -222,11 +246,6 @@ class UserPreferencesContribute extends AbstractUserPreferences {

Future<void> _share(String content) async => Share.share(content);

Future<void> _donate() async => LaunchUrlHelper.launchURL(
AppLocalizations.of(context).donate_url,
false,
);

Future<void> _contributors() => showDialog<void>(
context: context,
builder: (BuildContext context) => _ContributorsDialog(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class UserPreferencesFaq extends AbstractUserPreferences {
title: appLocalizations.nutrition_facts,
url: 'https://world.openfoodfacts.org/traffic-lights',
svg: 'assets/cache/low.svg',
leadingSvgWidth: 1.5 * DEFAULT_ICON_SIZE,
),
_getListTile(
title: appLocalizations.discover,
Expand All @@ -95,7 +96,7 @@ class UserPreferencesFaq extends AbstractUserPreferences {
),
_getListTile(
title: appLocalizations.feed_back,
leadingIconData: Icons.feedback_sharp,
leadingIconData: Icons.add_comment,
url: UserFeedbackHelper.getFeedbackFormLink(),
),
_getListTile(
Expand Down Expand Up @@ -156,6 +157,7 @@ class UserPreferencesFaq extends AbstractUserPreferences {
required final String title,
final IconData? leadingIconData,
final String? leadingSvg,
final double? leadingSvgWidth,
final String? url,
final VoidCallback? onTap,
final Icon? icon,
Expand All @@ -176,7 +178,7 @@ class UserPreferencesFaq extends AbstractUserPreferences {
? null
: SvgPicture.asset(
leadingSvg,
width: 2 * DEFAULT_ICON_SIZE,
width: leadingSvgWidth ?? 2 * DEFAULT_ICON_SIZE,
package: AppHelper.APP_PACKAGE,
),
),
Expand All @@ -188,10 +190,12 @@ class UserPreferencesFaq extends AbstractUserPreferences {
required final String title,
required final String url,
required final String svg,
final double? leadingSvgWidth,
}) =>
_getListTile(
title: title,
leadingSvg: svg,
leadingSvgWidth: leadingSvgWidth,
url: ProductQuery.replaceSubdomain(url),
);

Expand Down

0 comments on commit 8193cf1

Please sign in to comment.