Skip to content

Change default cache extent - #182905

Closed
chunhtai wants to merge 2 commits into
flutter:masterfrom
chunhtai:issues/98572-alt
Closed

chunhtai wants to merge 2 commits into
flutter:masterfrom
chunhtai:issues/98572-alt

Conversation

@chunhtai

Copy link
Copy Markdown
Contributor

fixes #98572

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels Feb 25, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request changes the default cache extent for viewports from a fixed pixel value (250.0) to a fraction of the viewport size (0.8). This is achieved by introducing a new default constant kDefaultScrollCacheExtent and updating viewport-related classes to use it. The old defaultCacheExtent is deprecated. Tests are updated to reflect this change. My review identifies a couple of areas for improvement in the implementation logic.

@github-actions github-actions Bot added the p: material_ui material_ui package in flutter/packages label Feb 26, 2026
@github-actions github-actions Bot added the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Feb 26, 2026
// Only items 10~16 are on the screen.
expect(find.text('item9'), findsNothing);
expect(find.text('item10'), findsOneWidget);
// Only items 9~16 are on the screen (or in cache).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is due to children rebuild may produce different scroll offset depends on how many children is built on screen. for example
if children 5,6,7,8 and a rebuild happens, the scroll extent will be at 5 after the rebuild finish.

Since the change increase cache extent, the children becomes like 3,4,5,6,7,8,9,10. so the scroll extent will be at 3 after rebuild finishes

@chunhtai
chunhtai requested a review from Piinks March 2, 2026 19:19

@Piinks Piinks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think there might be a bug in how this affects the current cacheExtent setter for RenderViewportBase and TwoDimensionalViewport, see test repros here: https://gist.github.com/Piinks/129ce6cf3f6c03d8d6188f292a7325c9 . Let me know what you think.

@chunhtai

chunhtai commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

addressed the issue

@Piinks

Piinks commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

@Piinks Piinks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@dkwingsmt dkwingsmt added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Mar 25, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 1, 2026
@auto-submit

auto-submit Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/182905, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR.

@flutter-dashboard

Copy link
Copy Markdown

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 22, 2026
@dkwingsmt dkwingsmt added the CICD Run CI/CD label Apr 22, 2026
@chunhtai

Copy link
Copy Markdown
Contributor Author

update: I am still working on this. the internal migration is still ongoing.

@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 24, 2026
@chunhtai chunhtai added the CICD Run CI/CD label Apr 24, 2026
@chunhtai chunhtai added the waiting for code freeze This PR is waiting for a code freeze to resolve. label May 27, 2026
@chunhtai
chunhtai marked this pull request as draft May 27, 2026 21:42
@flutter-dashboard

Copy link
Copy Markdown

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Piinks Piinks added the Decoupling: Not ready to port yet Instructions will be provided when this is ready to move to flutter/packages. label Jun 24, 2026
@Piinks

Piinks commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

I've marked this PR as not ready to port to flutter/packages yet.
We'll provide instructions to move this change over to material_ui/cupertino_ui once ready to receive PRs. Thank you!

The changes not in the material or cupertino libraries will remain here.

@Piinks Piinks added the Decoupling: Split PR The PR will need to be split to separate Material & Cupertino changes label Jun 24, 2026
@Piinks

Piinks commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Advice for PR splitting: Since this touches material/cupertino along with other parts of flutter/flutter, it will need to be split up.

If the material/cupertino changes are dependent on the other non-material/cupertino changes in this PR, then the material/cupertino changes will need to wait for them to roll to stable before they can be ported over to material_ui/cupertino_ui in flutter/packages (which uses the stable branch).

  • If that is the case here, consider opening a new PR with the non-material/cupertino changes to move forward with so that waiting period can be reduced. Up to you!

@Piinks

Piinks commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Greetings from stale PR triage! 👋
Is this change still on your radar?

@chunhtai

chunhtai commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

let me close this for now

@chunhtai chunhtai closed this Oct 2, 2026
@LouiseHsu LouiseHsu mentioned this pull request Nov 3, 2026
10 of 11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) CICD Run CI/CD Decoupling: Not ready to port yet Instructions will be provided when this is ready to move to flutter/packages. Decoupling: Split PR The PR will need to be split to separate Material & Cupertino changes f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages waiting for code freeze This PR is waiting for a code freeze to resolve.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessibility Focus jumps to Scaffold's AppBar while trying to swipe down or up in a listview

3 participants