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

Dynamically limit the number of elements rendered on Scan card. #648

Merged
merged 18 commits into from
Nov 12, 2021

Conversation

jasmeet0817
Copy link
Contributor

@jasmeet0817 jasmeet0817 commented Nov 3, 2021

Render only a limited amount of elements on the summary card if it's being shown in the scan page. Even though the code tries to dynamically determine the number of elements to render, it's possible that the elements try to overflow the summary card, in this case we clip the overflown widget (which may not look pretty)

This is a poor man's solution, the proper (and lengthy) way would be to build a custom render object.

Bonus: Standardize the size of Summary card and Search card.

Scan Page:
!Screenshot_1636646307
Screenshot_1636646255
Screenshot_1636646236

Product page (unchanged):
image

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.

Hello @jasmeet0817, I see what you are trying to do here, but I fear that the current way will cause problems when the screensize and the user settings deviate too much from the norm.
We should definitely test out this PR

Some time ago I have worked on making the app responsive and I can really recommend device_preview, you have to add it to the code and remove it before merging but it is great for testing different screen sizes and font sizes etc..

Comment on lines +30 to +31
// Each row in the summary card takes roughly 40px.
const int SUMMARY_CARD_ROW_HEIGHT = 40;
Copy link
Member

Choose a reason for hiding this comment

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

That's hard to say, what happens if the user has as an example adjusted his font size

@jasmeet0817
Copy link
Contributor Author

Hello @jasmeet0817, I see what you are trying to do here, but I fear that the current way will cause problems when the screensize and the user settings deviate too much from the norm. We should definitely test out this PR

Some time ago I have worked on making the app responsive and I can really recommend device_preview, you have to add it to the code and remove it before merging but it is great for testing different screen sizes and font sizes etc..

Marvin, thanks for the tip, I tested the change on several devices using DevicePreview, it looks fine, moreover, I'm now clipping any overflowing elements so we don't get an overflow error

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.

Thanks Jasmeet, the code looks good. An almost perfect solution is in any case better than none at all. We should however add an issue or a todo so that this task can be found.

@jasmeet0817
Copy link
Contributor Author

Thanks Jasmeet, the code looks good. An almost perfect solution is in any case better than none at all. We should however add an issue or a todo so that this task can be found.

Mentioned it in the launch tracker: #655

@jasmeet0817 jasmeet0817 merged commit 09dd7a9 into openfoodfacts:develop Nov 12, 2021
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