Sitelet https://github.com/flutter/flutter/pull/170210
Skip to content

Fix infinite loop in CupertinoSliverNavigationBar collapse animation by adding bounds check for target scroll position - #170210

Merged
auto-submit[bot] merged 24 commits into
flutter:masterfrom
techouse:fix/CupertinoSliverNavigationBar-collapse-animation-infinite-loop
Jul 1, 2025
Merged

auto-submit[bot] merged 24 commits into
flutter:masterfrom
techouse:fix/CupertinoSliverNavigationBar-collapse-animation-infinite-loop

Conversation

@techouse

@techouse techouse commented Jun 8, 2025 •

Copy link
Copy Markdown
Contributor

This pull request includes a fix to the CupertinoSliverNavigationBarState class in the nav_bar.dart file. The change ensures that the animateTo method is only called when the target is within the valid scroll extent range, i.e. target <= position.maxScrollExtent.

Fixes #164458

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.

@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages labels Jun 8, 2025
@techouse

techouse commented Jun 8, 2025 •

Copy link
Copy Markdown
Contributor Author

@victorsanni, could you please take a look at this once you have a chance? 🙏

I'm not really sure why the Mac_arm64 and Mac_x64 "tool_test_commands" tests are failing. 🤷

@victorsanni
victorsanni self-requested a review June 9, 2025 18:45

@victorsanni victorsanni 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 with a nit. Thanks for the fix.

Comment thread packages/flutter/test/cupertino/nav_bar_test.dart Outdated
@techouse

techouse commented Jun 11, 2025 •

Copy link
Copy Markdown
Contributor Author

@MitchellGoodwin @victorsanni how likely is it for this fix to make it into a CP?

@victorsanni

Copy link
Copy Markdown
Contributor

@MitchellGoodwin @victorsanni how likely is it for this fix to make it into a CP?

Very unlikely. While it's not a new feature, it's also not a crash or something that severely breaks customers.

Comment thread packages/flutter/test/cupertino/nav_bar_test.dart Outdated
Comment thread packages/flutter/test/cupertino/nav_bar_test.dart Outdated
Comment thread packages/flutter/test/cupertino/nav_bar_test.dart Outdated
Comment thread packages/flutter/test/cupertino/nav_bar_test.dart Outdated
Comment thread packages/flutter/test/cupertino/nav_bar_test.dart Outdated
Comment thread packages/flutter/test/cupertino/nav_bar_test.dart Outdated
Comment thread packages/flutter/test/cupertino/nav_bar_test.dart Outdated
@techouse

techouse commented Jun 11, 2025 •

Copy link
Copy Markdown
Contributor Author

Very unlikely. While it's not a new feature, it's also not a crash or something that severely breaks customers.

I see. I was under the impression that #164458 was labelled as a P2 because it has a particularly severe impact on Android.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 2, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 4, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 4, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 4, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 5, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 5, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 6, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 6, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 6, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 7, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 7, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 7, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
…by adding bounds check for target scroll position (flutter#170210)

This pull request includes a fix to the
`CupertinoSliverNavigationBarState` class in the `nav_bar.dart` file.
The change ensures that the `animateTo` method is only called when the
`target` is within the valid scroll extent range, i.e. `target <=
position.maxScrollExtent`.

Fixes flutter#164458

## 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: Victor Sanni <victorsanniay@gmail.com>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
…imation by adding bounds check for target scroll position (flutter/flutter#170210)
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
…by adding bounds check for target scroll position (flutter#170210)

This pull request includes a fix to the
`CupertinoSliverNavigationBarState` class in the `nav_bar.dart` file.
The change ensures that the `animateTo` method is only called when the
`target` is within the valid scroll extent range, i.e. `target <=
position.maxScrollExtent`.

Fixes flutter#164458

## 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: Victor Sanni <victorsanniay@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CupertinoSliverNavigationBar's collapse animation can get stuck in an infinite loop

3 participants