Skip to content

Fix Range Slider issue where indescrete ranges lead to out of range r…#181082

Merged
auto-submit[bot] merged 7 commits intoflutter:masterfrom
chris-prenissl:bugfix/180984-Range-Slider-Rounding-error-causes-values-end-to-exceed-max
Jan 27, 2026
Merged

Fix Range Slider issue where indescrete ranges lead to out of range r…#181082
auto-submit[bot] merged 7 commits intoflutter:masterfrom
chris-prenissl:bugfix/180984-Range-Slider-Rounding-error-causes-values-end-to-exceed-max

Conversation

@chris-prenissl
Copy link
Contributor

@chris-prenissl chris-prenissl commented Jan 16, 2026

These change fixes a problem when during a drag that took the minThumbSepartionValue into account led to a value outside of the allowed range of (0.0, 1.0) which caused a exception in rebuild where assert is used to check for that range.

Fixes issue #180984

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

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: material design flutter/packages/flutter/material repository. labels Jan 16, 2026
@chris-prenissl
Copy link
Contributor Author

chris-prenissl commented Jan 16, 2026

Fixing the bug for the specific configuration of the emulator Medium_Phone 36.1 Google Play was easy.

I'm not so sure how to write a correct widget test that has a general meaning and exactly covers the unfortunate calculation.

Can you please help me @darshankawar ? :)

Thank you

@chris-prenissl chris-prenissl marked this pull request as ready for review January 17, 2026 11:08
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 addresses an issue where dragging a thumb on a continuous RangeSlider could result in values outside the expected [0.0, 1.0] range, leading to an assertion failure. The fix involves wrapping the new values in _discretizeRangeValues before calling onChanged, which correctly clamps the values within the valid range. This change is consistent with how values are handled in _startInteraction. The fix is correct and minimal.

Copy link
Contributor

@victorsanni victorsanni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, this PR will need a test to prevent it from getting regressed. Thanks for the work.

@chris-prenissl chris-prenissl force-pushed the bugfix/180984-Range-Slider-Rounding-error-causes-values-end-to-exceed-max branch from bf3561b to ebe0e8d Compare January 21, 2026 16:22
Copy link
Contributor

@victorsanni victorsanni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@chris-prenissl chris-prenissl force-pushed the bugfix/180984-Range-Slider-Rounding-error-causes-values-end-to-exceed-max branch from eadf0e9 to b4b820d Compare January 22, 2026 18:14
Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually not able to reproduce it, so I put a comment in the original issue. Please let me know if I misunderstood anything! Thanks a lot for your contribution!

Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks:)!

@QuncCccccc QuncCccccc linked an issue Jan 26, 2026 that may be closed by this pull request
@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 26, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Jan 27, 2026
Merged via the queue into flutter:master with commit cba43b9 Jan 27, 2026
70 of 71 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 27, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2026
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 27, 2026
flutter/flutter@7165649...dfd92b7

2026-01-27 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fixes metal vec3 uniform padding (#181340)" (flutter/flutter#181552)
2026-01-27 [email protected] Change update_engine_version documenation (flutter/flutter#181508)
2026-01-27 [email protected] Roll Packages from e712bfa to e37af11 (7 revisions) (flutter/flutter#181544)
2026-01-27 [email protected] Roll FreeType to 2.14.1 (flutter/flutter#181428)
2026-01-27 [email protected] Roll Skia from 566d202962d3 to c2754838b077 (3 revisions) (flutter/flutter#181536)
2026-01-27 [email protected] [Material] modernize time picker components with Dart 3 switch expressions (flutter/flutter#181356)
2026-01-27 [email protected] Roll Skia from 55a87b50a368 to 566d202962d3 (1 revision) (flutter/flutter#181528)
2026-01-27 [email protected] Roll Dart SDK from f55d4538469a to 4c7cb0a1d07d (2 revisions) (flutter/flutter#181526)
2026-01-27 [email protected] Replace `pub run` mentions with `dart run` (flutter/flutter#181317)
2026-01-27 [email protected] Roll Skia from 1a15ed6b17f2 to 55a87b50a368 (1 revision) (flutter/flutter#181523)
2026-01-27 [email protected] Marks linux_chrome_dev_mode to be unflaky (flutter/flutter#181352)
2026-01-27 [email protected] Roll Skia from f2c1aa140b79 to 1a15ed6b17f2 (2 revisions) (flutter/flutter#181514)
2026-01-27 [email protected] Fix Range Slider issue where indescrete ranges lead to out of range r… (flutter/flutter#181082)
2026-01-26 [email protected] Roll Dart SDK from ba23b5ed0a97 to f55d4538469a (2 revisions) (flutter/flutter#181512)
2026-01-26 [email protected] Add `alignment` to `SizeTransition` (flutter/flutter#177895)
2026-01-26 [email protected] Roll Fuchsia Linux SDK from T4qTEa3T5CCSCIoJY... to akraNGn2lw4T1msgZ... (flutter/flutter#181509)
2026-01-26 [email protected] Roll Skia from be280d242a60 to f2c1aa140b79 (3 revisions) (flutter/flutter#181504)
2026-01-26 [email protected] Fixes metal vec3 uniform padding (flutter/flutter#181340)
2026-01-26 [email protected] Fixes duplicated import in accessibility test library (flutter/flutter#181506)
2026-01-26 [email protected] [Reland] Don't strip symbols from `libapp.so` on android by default (flutter/flutter#181275)
2026-01-26 [email protected] Fix Gradle path in Android Platform Embedder README. (flutter/flutter#181501)
2026-01-26 [email protected] Remove unused `ActivityLifecycleListener` class (flutter/flutter#181406)

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

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter-zl pushed a commit to flutter-zl/flutter that referenced this pull request Feb 10, 2026
flutter#181082)

*These change fixes a problem when during a drag that took the
minThumbSepartionValue into account led to a value outside of the
allowed range of (0.0, 1.0) which caused a exception in rebuild where
assert is used to check for that range.*

Fixes issue flutter#180984 

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## 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.

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](https://developers.google.com/gemini-code-assist/docs/review-github-code).
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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

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. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Range Slider: Rounding error causes values.end to exceed max

3 participants