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: 4513 - new "preferences search" page from dev mode #4640

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

monsieurtanuki
Copy link
Contributor

What

  • The general idea of this PR is to attach labels to preference widgets.
  • With those labels, we're able to pre-filter the preference widgets, and therefore to implement a "preference search" page
  • Reviewers should focus on new files user_preferences_item.dart and user_preferences_search_page.dart. The rest of the PR is just about preference pages that contain UserPreferencesItems instead of mere Widgets.

Screenshot

new "preference search" (bottom / dev mode) "allergens" search
Screenshot_2023-09-15-15-38-35 Screenshot_2023-09-15-14-47-15
"vege" search "amoled" search
Screenshot_2023-09-15-14-28-33 Screenshot_2023-09-15-14-24-12
"score" search (top) "score" search (bottom)
Screenshot_2023-09-15-14-22-59 Screenshot_2023-09-15-14-25-04
"follow" search "fat" search
Screenshot_2023-09-15-14-23-18 Screenshot_2023-09-15-14-22-40
"nova" search "nutrition" search
Screenshot_2023-09-15-14-22-17 Screenshot_2023-09-15-14-21-52

Part of

Files

Deleted files:

  • user_preferences_camera_sound.dart
  • user_preferences_crash_reporting.dart
  • user_preferences_haptic_feedback.dart
  • user_preferences_send_anonymous.dart

New files:

  • user_preferences_item.dart: Item for preferences, with labels for pre-filtering and widget builder.
  • user_preferences_search_page.dart: Search page for preferences, with TextField filter.

Impacted files:

  • abstract_user_preferences.dart: new getLabels method for filtering; children are now UserPreferencesItem for filtering; minor refactoring.
  • user_preferences_account.dart: children are now UserPreferencesItem; minor refactoring
  • user_preferences_advanced_settings.dart: added a static UserPreferencesItem getter
  • user_preferences_attribute_group.dart: children are now UserPreferencesItem; minor refactoring
  • user_preferences_choose_accent_color.dart: added a static UserPreferencesItem getter
  • user_preferences_choose_app_theme.dart: added a static UserPreferencesItem getter
  • user_preferences_choose_text_color_contrast.dart: added a static UserPreferencesItem getter
  • user_preferences_connect.dart: children are now UserPreferencesItem; minor refactoring
  • user_preferences_contribute.dart: children are now UserPreferencesItem; minor refactoring
  • user_preferences_country_selector.dart: added a static UserPreferencesItem getter
  • user_preferences_dev_mode.dart: children are now UserPreferencesItem; minor refactoring
  • user_preferences_faq.dart: children are now UserPreferencesItem; minor refactoring
  • user_preferences_food.dart: children are now UserPreferencesItem; minor refactoring
  • user_preferences_image_source.dart: added a static UserPreferencesItem getter
  • user_preferences_language_selector.dart: added a static UserPreferencesItem getter
  • user_preferences_page.dart: moved getUserPreferences to PreferencePageType; minor refactoring
  • user_preferences_rate_us.dart: added a static UserPreferencesItem getter
  • user_preferences_settings.dart: children are now UserPreferencesItem; minor refactoring
  • user_preferences_share_with_friends.dart: added a static UserPreferencesItem getter
  • user_preferences_widgets.dart: new classes UserPreferencesItemSwitch and UserPreferencesItemTile

Deleted files:
* `user_preferences_camera_sound.dart`
* `user_preferences_crash_reporting.dart`
* `user_preferences_haptic_feedback.dart`
* `user_preferences_send_anonymous.dart`

New files:
* `user_preferences_item.dart`: Item for preferences, with labels for pre-filtering and widget builder.
* `user_preferences_search_page.dart`: Search page for preferences, with TextField filter.

Impacted files:
* `abstract_user_preferences.dart`: new `getLabels` method for filtering; children are now `UserPreferencesItem` for filtering; minor refactoring.
* `user_preferences_account.dart`: children are now `UserPreferencesItem`; minor refactoring
* `user_preferences_advanced_settings.dart`: added a static `UserPreferencesItem` getter
* `user_preferences_attribute_group.dart`: children are now `UserPreferencesItem`; minor refactoring
* `user_preferences_choose_accent_color.dart`: added a static `UserPreferencesItem` getter
* `user_preferences_choose_app_theme.dart`: added a static `UserPreferencesItem` getter
* `user_preferences_choose_text_color_contrast.dart`: added a static `UserPreferencesItem` getter
* `user_preferences_connect.dart`: children are now `UserPreferencesItem`; minor refactoring
* `user_preferences_contribute.dart`: children are now `UserPreferencesItem`; minor refactoring
* `user_preferences_country_selector.dart`: added a static `UserPreferencesItem` getter
* `user_preferences_dev_mode.dart`: children are now `UserPreferencesItem`; minor refactoring
* `user_preferences_faq.dart`: children are now `UserPreferencesItem`; minor refactoring
* `user_preferences_food.dart`: children are now `UserPreferencesItem`; minor refactoring
* `user_preferences_image_source.dart`: added a static `UserPreferencesItem` getter
* `user_preferences_language_selector.dart`: added a static `UserPreferencesItem` getter
* `user_preferences_page.dart`: moved `getUserPreferences` to `PreferencePageType`; minor refactoring
* `user_preferences_rate_us.dart`: added a static `UserPreferencesItem` getter
* `user_preferences_settings.dart`: children are now `UserPreferencesItem`; minor refactoring
* `user_preferences_share_with_friends.dart`: added a static `UserPreferencesItem` getter
* `user_preferences_widgets.dart`: new classes `UserPreferencesItemSwitch` and `UserPreferencesItemTile`
Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting approach, could be very usefull in our very big nested settings

final ThemeData themeData = Theme.of(context);
final ProductPreferences productPreferences =
context.read<ProductPreferences>();
context.read<UserManagementProvider>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this have any use here

mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
TextField(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should (if moved out of the dev mode) switch to the SmoothTextFormField

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should (if moved out of the dev mode) switch to the SmoothTextFormField

Of course the UI/UX should be redesigned once the concept is approved and the code moved beyond the dev mode.

@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for your review!

Interesting approach, could be very usefull in our very big nested settings

I cannot really picture what the final UI/UX will look like, and we definitely need all settings to be translated if we only access settings via text search.
I suggest that we gradually try to use only the dev mode / settings text search from now on to check how relevant it would be to use only the text search.
Perhaps, in addition to text search, a couple of shortcut buttons, to something like "nutrition preferences"?
@teolemon Any "next step" here?

@monsieurtanuki monsieurtanuki merged commit 1096948 into openfoodfacts:develop Sep 19, 2023
6 checks passed
@teolemon
Copy link
Member

I would restyle the search bar, like this: Screenshot_20230919-092801.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants