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
@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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 8, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 8, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 8, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Dec 8, 2025
Roll Flutter from 5b8720312a94 to b2de367c41e0 (38 revisions)

flutter/flutter@5b87203...b2de367

2025-12-08 [email protected] Roll Packages from b17d3ff to 33a9a81 (3 revisions) (flutter/flutter#179579)
2025-12-08 [email protected] Roll Fuchsia Linux SDK from XCoAHsnYnKrvuWU2o... to _pSztGZvEA3-Ry-GW... (flutter/flutter#179575)
2025-12-08 [email protected] Implementation of `TestWindowingOwner` for testing multi-window (flutter/flutter#179355)
2025-12-08 [email protected] Roll Dart SDK from 11efe37089a7 to 75899721aa42 (2 revisions) (flutter/flutter#179573)
2025-12-08 [email protected] Roll Skia from 0c016e4aefd5 to b1936c760645 (8 revisions) (flutter/flutter#179568)
2025-12-08 [email protected] Roll Skia from 3c5f9e0c9269 to 0c016e4aefd5 (1 revision) (flutter/flutter#179565)
2025-12-08 [email protected] Roll Dart SDK from 1a6c6f6398af to 11efe37089a7 (1 revision) (flutter/flutter#179564)
2025-12-07 [email protected] Roll Skia from 4830855b6f84 to 3c5f9e0c9269 (1 revision) (flutter/flutter#179561)
2025-12-07 [email protected] Roll Skia from d5a6b6af6d12 to 4830855b6f84 (1 revision) (flutter/flutter#179557)
2025-12-07 [email protected] Roll Fuchsia Linux SDK from KilaJW3p3J_0yUDtV... to XCoAHsnYnKrvuWU2o... (flutter/flutter#179551)
2025-12-06 [email protected] Roll Skia from 33b32cecb287 to d5a6b6af6d12 (1 revision) (flutter/flutter#179540)
2025-12-06 [email protected] Roll Dart SDK from ea201dd2ef12 to 1a6c6f6398af (1 revision) (flutter/flutter#179539)
2025-12-06 [email protected] Roll Dart SDK from d1d30ee8d5a0 to ea201dd2ef12 (1 revision) (flutter/flutter#179537)
2025-12-06 [email protected] Roll Dart SDK from 30c906aa00f2 to d1d30ee8d5a0 (1 revision) (flutter/flutter#179534)
2025-12-06 [email protected] Roll Skia from dccd48c6c6ab to 33b32cecb287 (2 revisions) (flutter/flutter#179531)
2025-12-06 [email protected] Roll Fuchsia Linux SDK from vDeTl_KBeLJY8nCAx... to KilaJW3p3J_0yUDtV... (flutter/flutter#179530)
2025-12-06 [email protected] Roll Dart SDK from f3690c23d422 to 30c906aa00f2 (2 revisions) (flutter/flutter#179529)
2025-12-06 [email protected] Roll Skia from e19670f70406 to dccd48c6c6ab (6 revisions) (flutter/flutter#179524)
2025-12-05 [email protected] Make sure that a CupertinoFormRow doesn't crash in 0x0 environment (flutter/flutter#178979)
2025-12-05 [email protected] Make sure that a CupertinoContextMenuAction doesn't crash in 0x0 envi… (flutter/flutter#178721)
2025-12-05 [email protected] Make sure that a CupertinoRadio doesn't crash in 0x0 environment (flutter/flutter#179378)
2025-12-05 [email protected] Make sure that a CupertinoSearchTextField doesn't crash in 0x0 enviro… (flutter/flutter#179487)
2025-12-05 [email protected] Make sure that a CupertinoPicker doesn't crash in 0x0 environment (flutter/flutter#179258)
2025-12-05 [email protected] Make sure that a CupertinoAlertDialog doesn't crash in 0x0 environment (flutter/flutter#178858)
2025-12-05 [email protected] Make sure that a CupertinoListTileChevron doesn't crash in 0x0 enviro… (flutter/flutter#179165)
2025-12-05 [email protected] Make sure that CupertinoNavigationBar doesn't crash in 0x0 environment (flutter/flutter#179235)
2025-12-05 [email protected] Replace dropdown button with dropdown menu (flutter/flutter#179095)
2025-12-05 [email protected] Make sure that a CupertinoCheckbox doesn't crash in 0x0 environment (flutter/flutter#178630)
2025-12-05 [email protected] Make sure that a CupertinoApp doesn't crash in 0x0 environment (flutter/flutter#178610)
2025-12-05 [email protected] Make sure that a CupertinoButton doesn't crash in 0x0 environment (flutter/flutter#178629)
2025-12-05 [email protected] Make sure that a CupertinoTimerPicker doesn't crash in 0x0 environment (flutter/flutter#178857)
2025-12-05 [email protected] Make sure that a CupertinoScrollbar doesn't crash in 0x0 environment (flutter/flutter#179442)
2025-12-05 [email protected] Roll Dart SDK from 0fcab487446d to f3690c23d422 (1 revision) (flutter/flutter#179517)
2025-12-05 [email protected] Update several comments related to theme normalization (flutter/flutter#179457)
2025-12-05 [email protected] Reimplemented StretchingOverscrollIndicator with Simulation ported from Android 12. (flutter/flutter#173849)
2025-12-05 [email protected] Roll Skia from a31411879251 to e19670f70406 (1 revision) (flutter/flutter#179511)
2025-12-05 [email protected] chore: mark tests as flaky (flutter/flutter#179518)
2025-12-05 [email protected] Roll Dart SDK from 42fe3327abca to 0fcab487446d (3 revisions) (flutter/flutter#179506)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose
...
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…om Android 12. (flutter#173849)

Fixed an issue flutter#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

[fling](https://github.com/user-attachments/assets/3944eef3-baaa-47df-82ca-9c49d4283fe4)

## Pull And Reduce
Also, a very similar animation is implemented when pulling as well.


[pull](https://github.com/user-attachments/assets/2a3025dc-0996-403d-b58b-d07f25487cda)

## Pre-launch Checklist

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

---------

Co-authored-by: Tong Mu <[email protected]>
Co-authored-by: Victor Sanni <[email protected]>
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