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

[Optimize scrolling] Scrolling of grid shows black/empty items #127

Closed
yanivshaked opened this issue May 10, 2021 · 7 comments · Fixed by #128
Closed

[Optimize scrolling] Scrolling of grid shows black/empty items #127

yanivshaked opened this issue May 10, 2021 · 7 comments · Fixed by #128
Labels
await test The issue/PR is waiting for further tests. b: severe This issue need to be fixed ASAP. e: performance This issue is related to performance. ⚠️RELEASE BLOCKER This issue must be solved before next release. s: bug Something isn't working. s: UI This issue is related with UI or layout. ⏳TODAY This issue is scheduled to be solved today.

Comments

@yanivshaked
Copy link
Contributor

Problem description:
When scrolling the grid, it happens very often that all the grid items become black, and then they are repopulated. It's a very bad experience for the user. It happens even when using very low resolution for the grid items.

Optimization suggestion:
Consider replacing the GridView.builder with SliverGrid with SliverChildBuilderDelegate that has findChildIndexCallback.
It is most likely that it will improve performance of scrolling.

If that direction sounds ok to you, I will be happy to try it and submit a PR.
If you have other thought, please share.

Thanks,
Yaniv

@yanivshaked yanivshaked added the await investigate The issue is waiting for further investigation. label May 10, 2021
@github-actions github-actions bot added the await triage The issue is waiting for triage. label May 10, 2021
@yanivshaked
Copy link
Contributor Author

Just to clarify - the issue occurs also when scrolling very slowly

@AlexV525
Copy link
Member

Not sure the optimization you are indicating, could you share some videos about it?

@AlexV525
Copy link
Member

Oh I see, that's the paging issue.

@AlexV525
Copy link
Member

AlexV525 commented May 10, 2021

If it does help, I'd happy to see you fix this.

@AlexV525 AlexV525 added b: severe This issue need to be fixed ASAP. s: bug Something isn't working. ⏳TOMORROW This issue is scheduled to be solved within two days. and removed await investigate The issue is waiting for further investigation. await triage The issue is waiting for triage. labels May 10, 2021
@yanivshaked
Copy link
Contributor Author

Following branch has the relevant changes, but issue is not solved:
https://github.com/12Tech12/flutter_wechat_assets_picker/tree/20210510_Fix_Grid_Scrolling

  1. There are multiple calls to provider.loadMoreAssets for the same page. I have fixed it using a critical section flag (dart is single threaded).
  2. Instead of replacing the entire _currentAssets list, I'm adding more assets to that list.

I have replaced GridView.builder with SliverGrid that has findChildIndexCallback - and that routine is called everytime the list is enlarged, but the paging issue is still there, entire grid is refreshed.

I'm still working on it, but please share your thoughts :-)

@AlexV525
Copy link
Member

  • Use the count of current assets instead of the list as a selector might help.
  • Increase the default value for each page (currently 80, to 120 maybe) to prevent loading more page at the very start.

@AlexV525
Copy link
Member

I do found a new way to solve this, will file a PR soon.

@AlexV525 AlexV525 added e: performance This issue is related to performance. s: developing This issue in under development. s: UI This issue is related with UI or layout. ⏳TODAY This issue is scheduled to be solved today. and removed ⏳TOMORROW This issue is scheduled to be solved within two days. labels May 11, 2021
@AlexV525 AlexV525 added await test The issue/PR is waiting for further tests. ⚠️RELEASE BLOCKER This issue must be solved before next release. and removed s: developing This issue in under development. labels May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
await test The issue/PR is waiting for further tests. b: severe This issue need to be fixed ASAP. e: performance This issue is related to performance. ⚠️RELEASE BLOCKER This issue must be solved before next release. s: bug Something isn't working. s: UI This issue is related with UI or layout. ⏳TODAY This issue is scheduled to be solved today.
Projects
None yet
2 participants