Skip to content

Conversation

@MTtankkeo
Copy link
Contributor

@MTtankkeo MTtankkeo commented Aug 15, 2025

Fixed an issue #169659

This PR improves the StretchingOverscrollIndicator to better match native Android behavior.

  • Previously, the stretch effect worked well only for slow dragging, and during fast flings it was absent or felt clipped.
  • Implemented a Simulation-based animation that responds naturally to both slow drags and high-velocity flings.
  • The result closely resembles the native Android overscroll behavior while maintaining Flutter's performance characteristics.

This change ensures that momentum-based gestures produce a more natural and intuitive overscroll experience, especially for users accustomed to native Android scroll views.

Fling

3.mp4

Pull And Reduce

Also, a very similar animation is implemented when pulling as well.

3.mp4

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels Aug 15, 2025
Copy link
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 is a great improvement to the StretchingOverscrollIndicator, replacing the previous animation logic with a more physically realistic SpringSimulation. This results in a much more natural feel, especially for high-velocity flings, aligning it better with native Android behavior. The code is well-structured, and the addition of a regression test is appreciated.

I've found a critical issue related to animation controller lifecycle management that could lead to race conditions. I've also identified a couple of medium-severity issues related to code clarity and maintainability. Addressing these will make the implementation more robust and easier to understand.

Overall, this is a high-quality contribution.

@justinmc justinmc requested a review from dkwingsmt August 19, 2025 22:11
@dkwingsmt
Copy link
Contributor

dkwingsmt commented Aug 25, 2025

Thank you for this amazing change! My first round of review focuses on the constants for the spring simulation.

@justinmc justinmc requested a review from victorsanni August 26, 2025 22:06
@MTtankkeo MTtankkeo requested review from a team as code owners August 30, 2025 08:22
@github-actions github-actions bot added a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems platform-android Android applications specifically platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. engine flutter/engine related. See also e: labels. f: material design flutter/packages/flutter/material repository. f: cupertino flutter/packages/flutter/cupertino repository platform-web Web applications specifically platform-linux Building on or for Linux specifically a: desktop Running on desktop e: impeller Impeller rendering backend issues and features requests team-android Owned by Android platform team team-ios Owned by iOS platform team labels Aug 30, 2025
@github-actions github-actions bot removed a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems platform-android Android applications specifically platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. engine flutter/engine related. See also e: labels. labels Aug 30, 2025
@dkwingsmt
Copy link
Contributor

I'd let @Piinks double check one last time with everything. However @Piinks is out for the week and will return by Oct 20.

@Piinks
Copy link
Contributor

Piinks commented Oct 21, 2025

Thanks Tong! I am rebasing here since it looks like there is no Google testing instance currently. We need that to validate we have resolved any remaining failures before merging.

@Piinks Piinks mentioned this pull request Oct 21, 2025
4 tasks
MTtankkeo and others added 22 commits October 21, 2025 18:42
@Piinks Piinks force-pushed the stretch_indicator branch from 0ccff30 to 7d737d5 Compare October 21, 2025 23:43
@Piinks
Copy link
Contributor

Piinks commented Oct 24, 2025

Checking in here: there are many failing tests behind the Google testing check here. I am working through them to validate the changes are expected, for example screenshot tests that captured the overscroll state.

@Piinks Piinks assigned chunhtai and Piinks and unassigned chunhtai Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

6 participants