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
@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
@Piinks Piinks moved this to In Progress in Google Testing Queue Nov 10, 2025
@Piinks
Copy link
Contributor

Piinks commented Nov 10, 2025

@MTtankkeo can you make this update in behavior opt-in? I have determined we won't be able to land this based on some of the failures coming from other dependencies that will have to update first once it gets to stable - https://pub.dev/packages/data_table_2 being one of them.

@MTtankkeo
Copy link
Contributor Author

@MTtankkeo can you make this update in behavior opt-in? I have determined we won't be able to land this based on some of the failures coming from other dependencies that will have to update first once it gets to stable - https://pub.dev/packages/data_table_2 being one of them.

@Piinks How should I implement the opt-in behavior? Personally, I can’t think of a good approach right now. Could you provide an example?

@victorsanni
Copy link
Contributor

victorsanni commented Nov 11, 2025

Failing tests in data_table_2:

EDIT: I think these are all the failing tests

@Piinks
Copy link
Contributor

Piinks commented Nov 11, 2025

One thing we could do is update data table to soften the affected tests, and roll the updated package into google, and then land this change. It looks like it's been 7 months since the package's last update.

@Piinks
Copy link
Contributor

Piinks commented Nov 11, 2025

@MTtankkeo which do you prefer, updating the package and then returning here, or introducing an opt in?

@MTtankkeo
Copy link
Contributor Author

@MTtankkeo which do you prefer, updating the package and then returning here, or introducing an opt in?

@Piinks Sounds good, I’ll look into fixing the failing tests in the data_table_2 package and open a PR soon.

@victorsanni
Copy link
Contributor

data_table_2 tests have been resolved, the only Google testing failures now are from image diffs.

@victorsanni
Copy link
Contributor

Looked through the screenshot tests, they all look intended with this PR.

@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 5, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Dec 5, 2025
Merged via the queue into flutter:master with commit 362b1de Dec 5, 2025
71 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Google Testing Queue Dec 5, 2025
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 5, 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

Development

Successfully merging this pull request may close these issues.

6 participants