Repository navigation
Commit 0b72e92
authored
[material_ui] Mirror the GappedSliderTrackShape secondary track correctly in RTL (flutter#13226)
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`:
<details open>
<summary>Screenshots demonstration</summary>
| State | Direction | Screenshot |
| :---: | :---: | :---: |
| **Before** | <kbd>LTR ➔</kbd><br><br><br><kbd>⬅ RTL</kbd> | <img width="1200" height="320" alt="2_gapped_BEFORE" src="https://github.com/user-attachments/assets/dfc9eb92-9b0c-4fd6-a087-253e7a0b586d" /> |
| **After** | <kbd>LTR ➔</kbd><br><br><br><kbd>⬅ RTL</kbd> | <img width="1200" height="320" alt="2_gapped_AFTER" src="https://github.com/user-attachments/assets/99599f28-dd24-41b6-80f3-cf889bc2fa74" /> |
</details>
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#194279
## Pre-Review Checklist
**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.
[^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.1 parent 2def459 commit 0b72e92
3 files changed
Lines changed: 82 additions & 8 deletions
File tree
- packages/material_ui
- lib/src
- pending_changelogs
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1200 | 1200 | | |
1201 | 1201 | | |
1202 | 1202 | | |
1203 | | - | |
| 1203 | + | |
1204 | 1204 | | |
1205 | | - | |
| 1205 | + | |
1206 | 1206 | | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
1211 | 1211 | | |
1212 | 1212 | | |
1213 | 1213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5400 | 5400 | | |
5401 | 5401 | | |
5402 | 5402 | | |
5403 | | - | |
| 5403 | + | |
| 5404 | + | |
| 5405 | + | |
| 5406 | + | |
| 5407 | + | |
5404 | 5408 | | |
5405 | 5409 | | |
5406 | 5410 | | |
5407 | 5411 | | |
5408 | 5412 | | |
5409 | 5413 | | |
5410 | 5414 | | |
5411 | | - | |
| 5415 | + | |
5412 | 5416 | | |
5413 | 5417 | | |
5414 | 5418 | | |
| |||
5465 | 5469 | | |
5466 | 5470 | | |
5467 | 5471 | | |
| 5472 | + | |
| 5473 | + | |
| 5474 | + | |
| 5475 | + | |
| 5476 | + | |
| 5477 | + | |
| 5478 | + | |
| 5479 | + | |
| 5480 | + | |
| 5481 | + | |
| 5482 | + | |
| 5483 | + | |
| 5484 | + | |
| 5485 | + | |
5468 | 5486 | | |
5469 | 5487 | | |
5470 | 5488 | | |
| 5489 | + | |
| 5490 | + | |
| 5491 | + | |
| 5492 | + | |
| 5493 | + | |
| 5494 | + | |
| 5495 | + | |
| 5496 | + | |
| 5497 | + | |
| 5498 | + | |
| 5499 | + | |
| 5500 | + | |
| 5501 | + | |
| 5502 | + | |
| 5503 | + | |
| 5504 | + | |
| 5505 | + | |
| 5506 | + | |
| 5507 | + | |
| 5508 | + | |
| 5509 | + | |
| 5510 | + | |
| 5511 | + | |
| 5512 | + | |
| 5513 | + | |
| 5514 | + | |
| 5515 | + | |
| 5516 | + | |
| 5517 | + | |
| 5518 | + | |
| 5519 | + | |
| 5520 | + | |
| 5521 | + | |
| 5522 | + | |
| 5523 | + | |
| 5524 | + | |
| 5525 | + | |
| 5526 | + | |
| 5527 | + | |
| 5528 | + | |
| 5529 | + | |
| 5530 | + | |
| 5531 | + | |
| 5532 | + | |
| 5533 | + | |
| 5534 | + | |
| 5535 | + | |
| 5536 | + | |
| 5537 | + | |
| 5538 | + | |
| 5539 | + | |
| 5540 | + | |
| 5541 | + | |
5471 | 5542 | | |
5472 | 5543 | | |
5473 | 5544 | | |
| |||
0 commit comments