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: Make attributes clickable #1654

Closed
wants to merge 7 commits into from
Closed

Conversation

M123-dev
Copy link
Member

What

  • Fixes: Make attributes tapable in the Summary card #1029

  • Created knowledge_panel_full_page moved from knowledge_panel_card into a own file

  • Created knowledge_panel_full_loading_page a new page which opens when clicking on a attribute, shows a loading indicator as long as the knowledge panel's aren't loaded yet. Replaces itself automatically.

  • Created DataProvider class for sharing custom data via Provider

  • main.dart created new DataProvider provider for sharing knowledge panel data, my first approach was to create a local provider on the product page, this turned out to not work as the provider isn't in the widget tree anymore when calling navigator.push (when the Provider is created below the MaterialApp)

  • new_product_page minor refactoring + updated to write and delete data from DataProvider

  • Created product_knowledge_panels moved from product page with accessing knowledge panel data via provider

  • summary_card make attributes clickable

@M123-dev M123-dev requested a review from a team as a code owner April 26, 2022 16:03
@codecov-commenter
Copy link

Codecov Report

Merging #1654 (289dbb7) into develop (2ea0da3) will decrease coverage by 0.60%.
The diff coverage is 0.35%.

@@            Coverage Diff             @@
##           develop   #1654      +/-   ##
==========================================
- Coverage     8.86%   8.25%   -0.61%     
==========================================
  Files          161     169       +8     
  Lines         6623    7158     +535     
==========================================
+ Hits           587     591       +4     
- Misses        6036    6567     +531     
Impacted Files Coverage Δ
...h_app/lib/cards/category_cards/abstract_cache.dart 0.00% <0.00%> (ø)
...p/lib/cards/category_cards/asset_cache_helper.dart 0.00% <0.00%> (ø)
...p/lib/cards/category_cards/raster_async_asset.dart 0.00% <0.00%> (ø)
...oth_app/lib/cards/category_cards/raster_cache.dart 0.00% <0.00%> (ø)
..._app/lib/cards/category_cards/svg_async_asset.dart 0.00% <0.00%> (ø)
...smooth_app/lib/cards/category_cards/svg_cache.dart 0.00% <0.00%> (ø)
...t_cards/knowledge_panels/knowledge_panel_card.dart 0.00% <0.00%> (ø)
...edge_panels/knowledge_panel_full_loading_page.dart 0.00% <0.00%> (ø)
...ds/knowledge_panels/knowledge_panel_full_page.dart 0.00% <0.00%> (ø)
...rds/knowledge_panels/knowledge_panels_builder.dart 2.17% <0.00%> (ø)
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ddb34d8...289dbb7. Read the comment docs.

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

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

@M123-dev Honestly I'm very surprised by several things I've seen.
Especially, you are very bold to change the way providers are dealt with in main.dart - huge impact if that doesn't work.
And the way you deal with loading page is not something I'm familiar with - I prefer LoadingDialog.
Besides, it's (once more) about knowledge panels, which is not something I've worked a lot on.
I can only comment. Not approve or even request changes: in both cases that would mean I'm comfortable enough to see how to improve things, and here I'm outside my comfort zone.

@@ -161,12 +164,18 @@ class _SmoothAppState extends State<SmoothApp> {
}

return MultiProvider(
providers: <ChangeNotifierProvider<ChangeNotifier>>[
providers: <SingleChildWidget>[
Copy link
Contributor

Choose a reason for hiding this comment

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

Very surprising. You must very confident to do something like that.

Copy link
Member Author

@M123-dev M123-dev Apr 26, 2022

Choose a reason for hiding this comment

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

Actually I just noticed this change isn't needed anymore, it's a leftover from an attempt to get it simpler, reverted. Thanks for pointing out

import 'package:smooth_app/cards/product_cards/knowledge_panels/knowledge_panel_full_page.dart';
import 'package:smooth_app/data_models/data_provider.dart';

class KnowledgePanelFullLoadingPage extends StatelessWidget {
Copy link
Contributor

Choose a reason for hiding this comment

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

Very surprised that you don't use LoadingDialog instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about that too, but that would have meant that I would have had to distribute the Future through the provider, this seemed to add even more complexity especially when you try to avoid having two calls (when opening the product page and when opening the attributes)

@teolemon
Copy link
Member

@jasmeet0817 could you chime in on this one ?

@teolemon
Copy link
Member

@monsieurtanuki I requested feedback from @jasmeet0817

@jasmeet0817
Copy link
Contributor

Thanks for flagging, I'll have a look in the morning tomorrow.

@M123-dev
Copy link
Member Author

M123-dev commented Apr 26, 2022

Actually @monsieurtanuki I am not exactly happy with the additional complexity of the PR's aswell. Especially the hacky way with the map provider is somewhat strange and not easy to understand on the first readthrough.

So if there are, even fundamental different, implementation suggestions I'm open to hearing them

@monsieurtanuki
Copy link
Contributor

@M123-dev The more I read your code the less I want to maintain it. I have absolutely no idea why you use a provider.
Of course I know sometimes you (not you in particular, everybody) can get caught in a bad spiral of unreadable code, that you desperately try to fix with even more irrelevant code.

I'm sure that if you just start again from scratch tomorrow morning, you'll find something much more elegant.

In the meanwhile, my suggestion - as far as I understand your goal ("What is your quest?"):

  • if you need local data in an async method before calling a page with that data as parameter
  • just get that local data async'ly (should take less than 1s)
  • and then pass it to the page as a parameter
  • et voilà!

@jasmeet0817
Copy link
Contributor

For my understanding sake, what's the high level plan for this change ? I remember vaguely the idea was that the server would send attribute id -> knowledge panel id. And on click the knowledge panel with that Id would open up. Is that still the plan

@M123-dev
Copy link
Member Author

Here @jasmeet0817 #1029 but the code is now in #1666 not here anymore

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

Successfully merging this pull request may close these issues.

Make attributes tapable in the Summary card
5 participants