Repository navigation
Commit 249f37d
authored
[material_ui] Paint the active RoundedRectSliderTrackShape segment on top in RTL (flutter#13225)
`RoundedRectSliderTrackShape` paints its two segments in a fixed order: the right-hand segment first, then the left-hand one. Both segments extend past the thumb center by half of the track height, so the segment painted last has its rounded end drawn over the other one.
In LTR the left-hand segment is the active one, so the active segment's rounded end is on top. In RTL the left-hand segment is the inactive one, so the inactive segment's rounded end was painted over the active segment, which left a pale sliver beside the thumb. This is only visible when the track is thicker than the thumb.
This PR paints the inactive segment first in both text directions. The LTR paint order is unchanged. The rounded `RangeSlider` track already paints its active segment last in both directions.
Before and after, LTR on top and RTL below, with `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="1_rounded_BEFORE" src="https://github.com/user-attachments/assets/8a4f0460-657c-4d53-8e1f-1534a850bcb1" /> |
| **After** | <kbd>LTR ➔</kbd><br><br><br><kbd>⬅ RTL</kbd> | <img width="1200" height="320" alt="1_rounded_AFTER" src="https://github.com/user-attachments/assets/25ec473c-a9f9-4c27-9380-7a2c728183c4" /> |
</details>
I added an RTL case to the existing `RoundedRectSliderTrackShape` test group. It checks the exact track rects and their paint order, and it fails without the fix.
Fixes flutter/flutter#194278
## 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 fc8b069 commit 249f37d
3 files changed
Lines changed: 73 additions & 24 deletions
File tree
- packages/material_ui
- lib/src
- pending_changelogs
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
399 | 402 | | |
400 | 403 | | |
401 | 404 | | |
| |||
463 | 466 | | |
464 | 467 | | |
465 | 468 | | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | 469 | | |
471 | 470 | | |
472 | 471 | | |
| |||
478 | 477 | | |
479 | 478 | | |
480 | 479 | | |
481 | | - | |
482 | 480 | | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
487 | 501 | | |
488 | 502 | | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
494 | 508 | | |
495 | | - | |
| 509 | + | |
496 | 510 | | |
497 | 511 | | |
498 | | - | |
499 | | - | |
500 | | - | |
| 512 | + | |
501 | 513 | | |
502 | 514 | | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
508 | 520 | | |
509 | | - | |
| 521 | + | |
510 | 522 | | |
511 | 523 | | |
512 | 524 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2677 | 2677 | | |
2678 | 2678 | | |
2679 | 2679 | | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
2680 | 2714 | | |
2681 | 2715 | | |
2682 | 2716 | | |
| |||
0 commit comments