Skip to content

[material_ui] Mirror the GappedSliderTrackShape secondary track correctly in RTL - #13226

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
SalehTZ:slider-rtl-gapped-secondary-track
Oct 29, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:mainfrom
SalehTZ:slider-rtl-gapped-secondary-track

Conversation

@SalehTZ

@SalehTZ SalehTZ commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

In RTL, GappedSliderTrackShape drew the secondary track from secondaryOffset.dx - trackGap to thumbCenter.dx. That filled the gap next to the thumb, which the main track segments and the LTR secondary track keep empty. The corner radii were also copied from the LTR case instead of being mirrored, so the far end had the small inside corners and the end by the thumb was fully rounded.

This PR draws the RTL secondary track from secondaryOffset.dx to thumbCenter.dx - trackGap, with the fully rounded corners on the far end and the small inside corners next to the thumb. That is the mirror image of the LTR case. The existing visibility check just above already used thumbCenter.dx - trackGap, so it matches the new geometry.

Before and after, LTR on top and RTL below, with Slider(year2023: false, secondaryTrackValue: ...) and trackHeight: 24:

Screenshots demonstration
State Direction Screenshot
Before LTR ➔


⬅ RTL
2_gapped_BEFORE
After LTR ➔


⬅ RTL
2_gapped_AFTER

I extended the existing Default Slider when year2023 is false test. It now also asserts the exact LTR secondary track, and has a new RTL block with the mirrored inactive, active and secondary tracks, including corner radii. The RTL block fails without the fix.

Fixes flutter/flutter#194279

Pre-Review 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.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

…ctly in RTL

In right-to-left layouts the secondary track was drawn from
`secondaryOffset.dx - trackGap` to the thumb center, so it filled the gap
next to the thumb, and its corners were not mirrored: the far end had the
small inside corners and the end by the thumb was fully rounded.

Draw it from `secondaryOffset.dx` to one track gap before the thumb, with
the corner radii mirrored from the left-to-right case.

Fixes flutter/flutter#194279
@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Oct 13, 2026
@SalehTZ
SalehTZ marked this pull request as ready for review October 13, 2026 07:41

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request modifies GappedSliderTrackShape in slider_parts.dart to adjust the drawing coordinates and corner radii of the secondary track in right-to-left (RTL) layouts. It also adds a pending changelog entry and updates slider_test.dart to include test coverage for the secondary track in both LTR and RTL configurations. There are no review comments, so I have no feedback to provide.

@Piinks
Piinks self-requested a review October 20, 2026 21:22
@Piinks Piinks added the CICD Run CI/CD label Oct 28, 2026

@Piinks Piinks 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! Thank you for this fix!

@navaronbracke navaronbracke 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

@navaronbracke navaronbracke added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 29, 2026
@auto-submit
auto-submit Bot merged commit 0b72e92 into flutter:main Oct 29, 2026
13 checks passed
Rheoz pushed a commit to Rheoz/flutter that referenced this pull request Oct 29, 2026
flutter/packages@13d38e0...0b72e92

2026-10-29 [email protected] [material_ui]
Mirror the GappedSliderTrackShape secondary track correctly in RTL
(flutter/packages#13226)
2026-10-29 [email protected] [pigeon] update jni dependency to ^1.1.1
and remove workaround proguard rules (flutter/packages#13464)
2026-10-28 [email protected] [cupertino_ui]
Document translucent default background of
CupertinoSlidingSegmentedControl (flutter/packages#13178)
2026-10-28 [email protected] [flutter_svg] Throw on non-2xx responses in
SvgNetworkLoader (flutter/packages#13403)
2026-10-28 [email protected] [tool] Fix package
matching logic for `--package-tags` filter (flutter/packages#13472)
2026-10-28 [email protected] Roll Flutter from
d4c8577 to 0c2473c (21 revisions) (flutter/packages#13470)

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

To file a bug in Flutter:
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[material_ui] Slider(year2023: false): secondary track is not mirrored correctly in RTL

3 participants