-
-
Notifications
You must be signed in to change notification settings - Fork 299
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: #2244 - new "add categories" button + major product provider refactoring #2276
feat: #2244 - new "add categories" button + major product provider refactoring #2276
Conversation
…t provider refactoring New file: * `up_to_date_product_provider.dart`: Provider that reflects all the user changes on [Product]s. Impacted files: * `add_basic_details_page.dart`: refactoring * `category_picker_page.dart`: refactoring * `edit_ingredients_page.dart`: refactoring around `UpToDateProductProvider` * `edit_product_page.dart`: refactoring around `UpToDateProductProvider` * `knowledge_panel_page_template.dart`: refactored for code clarity * `knowledge_panels_builder.dart`: refactored for code clarity * `main.dart`: added `UpToDateProductProvider` in the provider list * `new_product_page.dart`: refactoring around `UpToDateProductProvider`; removed deprecated code on "additional button" * `Podfile.lock`: wtf * `product_list_page.dart`: refactored around `UpToDateProductProvider` * `product_refresher.dart`: refactored around `UpToDateProductProvider` * `simple_input_page.dart`: refactored * `summary_card.dart`: implemented "add categories" button; refactored around `UpToDateProductProvider`
Codecov Report
@@ Coverage Diff @@
## develop #2276 +/- ##
==========================================
- Coverage 8.86% 7.79% -1.07%
==========================================
Files 161 180 +19
Lines 6623 9118 +2495
==========================================
+ Hits 587 711 +124
- Misses 6036 8407 +2371
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for this refactoring @monsieurtanuki
_, | ||
final UpToDateProductProvider provider, | ||
__, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure this is wanted probably because we don't need the other arguements. Looks odd non the less
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@M123-dev Yeah I know, the idea behind this kind of syntax in dart
is to avoid to add a pointless and confusing nth version of BuildContext
. Not a big fan of that syntax either.
if (!await ProductRefresher().checkIfLoggedIn(context)) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR but we should decide for clear rules who can edit what and probably show something like:
"Please login to edit this"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@M123-dev Oh we do display a dialog if the user is not logged in.
@@ -206,7 +199,7 @@ class _EditIngredientsPageState extends State<EditIngredientsPage> { | |||
)); | |||
} | |||
|
|||
return Scaffold( | |||
final Scaffold scaffold = Scaffold( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We started doing this a lot lately, I'm not a fan of having the scroll a lot to find the whole widget tree, what about putting it directly in the Consumer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@M123-dev I agree with you: the reason behind that 2 step return is to avoid that git
considers that all the text has changed just because the formatting added 2 spaces when we added a level with an extra child
.
There were enough changes in this PR and I didn't want to add work to the code reviewers ;)
Sounds good @monsieurtanuki, feel free to merge |
New file:
up_to_date_product_provider.dart
: Provider that reflects all the user changes on [Product]s.Impacted files:
add_basic_details_page.dart
: refactoringcategory_picker_page.dart
: refactoringedit_ingredients_page.dart
: refactoring aroundUpToDateProductProvider
edit_product_page.dart
: refactoring aroundUpToDateProductProvider
knowledge_panel_page_template.dart
: refactored for code clarityknowledge_panels_builder.dart
: refactored for code claritymain.dart
: addedUpToDateProductProvider
in the provider listnew_product_page.dart
: refactoring aroundUpToDateProductProvider
; removed deprecated code on "additional button"Podfile.lock
: wtfproduct_list_page.dart
: refactored aroundUpToDateProductProvider
product_refresher.dart
: refactored aroundUpToDateProductProvider
simple_input_page.dart
: refactoredsummary_card.dart
: implemented "add categories" button; refactored aroundUpToDateProductProvider
What
UpToDateProductProvider
Consume
(cf. code).ProductRefresher
, that will notify all the consumer.Fixes bug(s)