Skip to content

Add dedicated rubber band spring for overscroll recovery in BouncingScrollPhysics#187568

Open
MTtankkeo wants to merge 2 commits into
flutter:masterfrom
MTtankkeo:bouncing
Open

Add dedicated rubber band spring for overscroll recovery in BouncingScrollPhysics#187568
MTtankkeo wants to merge 2 commits into
flutter:masterfrom
MTtankkeo:bouncing

Conversation

@MTtankkeo
Copy link
Copy Markdown
Contributor

Note

Relanding #182426.

Thank you for your review and guidance on the previous PR.

I'm relanding this with the fix for the test failures that caused the issue before. (I've updated the regression test to account for the faster convergence rate of the new physics.)

Fixes #181752
(for detailed analysis, measurements, and discussion, please refer to the original issue.)

This pull request implements a dedicated “rubber band” physics for overscroll snap-back in BouncingScrollPhysics on iOS to better match the native UIScrollView feel.

546867255-4ad56291-9603-40c1-ae5a-3e319017c3c9

Note

This change adjusts spring constants and simulation behavior
to improve iOS scroll fidelity.

Given that this change primarily involves physics parameter tuning,
it may reasonably qualify as test-exempt. However, I am not entirely
certain what level of automated testing would be considered appropriate.

Please let me know if additional tests are expected,
and I am happy to update the PR accordingly.

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 Jun 4, 2026
Copy link
Copy Markdown
Contributor

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

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 introduces a new rubberBandSpring to BouncingScrollPhysics to simulate iOS-style exponential decay for stationary overscroll releases, updating related tests to reflect faster animation convergence. Feedback on the changes highlights a potential logic regression in createBallisticSimulation where using <= instead of < to define isStationary alters behavior when the velocity is exactly equal to the tolerance threshold.

Comment thread packages/flutter/lib/src/widgets/scroll_physics.dart Outdated
@MTtankkeo MTtankkeo changed the title Improve iOS scroll behavior by implementing rubber band bounce in Bou… Add dedicated rubber band spring for overscroll recovery in BouncingScrollPhysics Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal - Missing dedicated "Rubber Band" physics in BouncingScrollPhysics causes low iOS fidelity

1 participant