Repository navigation
Commit e81cfde
authored
[cupertino_ui] Dim disabled CupertinoSlider controls (#13419)
Dims `CupertinoSlider` to 50% opacity when `onChanged` is null, matching the disabled appearance in native UIKit Slider component on iOS. Adds light/dark regression tests for disabling and re-enabling the slider.
Fixes flutter/flutter#106691.
### Screenshots
Flutter before/after: iPhone 16 Pro simulator, iOS 18.6, light mode, value 0.67. The top slider is enabled; the bottom is disabled. The native reference shows stock `UISlider` controls in both themes.
| Before | After | Native UIKit reference |
| --- | --- | --- |
| <img src="https://raw.githubusercontent.com/Wreos/packages/e755e4de3f50f2505fbd7ecf98240159f22d4f6e/before-ios18.6.jpg" width="240" alt="Before: enabled and disabled sliders look identical"> | <img src="https://raw.githubusercontent.com/Wreos/packages/e755e4de3f50f2505fbd7ecf98240159f22d4f6e/after-ios18.6.jpg" width="240" alt="After: disabled slider is dimmed"> | <img src="https://raw.githubusercontent.com/Wreos/packages/e755e4de3f50f2505fbd7ecf98240159f22d4f6e/native-ios18.6.jpg" width="240" alt="Native UIKit: disabled sliders are dimmed in light and dark mode"> |
Also checked native UIKit on [iOS 26.5](https://raw.githubusercontent.com/Wreos/packages/e755e4de3f50f2505fbd7ecf98240159f22d4f6e/native-ios26.5.jpg), where the disabled visual element uses 0.5 opacity. This fixes disabled styling, not the slider's overall design.
Validation: all 23 tests in `test/slider_test.dart` pass; targeted analysis and formatting pass. The full package suite has not been run locally. No public API changes.
## 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 5365902 commit e81cfde
3 files changed
Lines changed: 83 additions & 15 deletions
File tree
- packages/cupertino_ui
- lib/src
- pending_changelogs
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
292 | 295 | | |
293 | 296 | | |
294 | 297 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
301 | 312 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | 313 | | |
308 | 314 | | |
309 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
25 | 84 | | |
26 | 85 | | |
27 | 86 | | |
| |||
439 | 498 | | |
440 | 499 | | |
441 | 500 | | |
442 | | - | |
| 501 | + | |
443 | 502 | | |
444 | 503 | | |
445 | 504 | | |
| |||
462 | 521 | | |
463 | 522 | | |
464 | 523 | | |
465 | | - | |
| 524 | + | |
466 | 525 | | |
467 | 526 | | |
468 | 527 | | |
| |||
480 | 539 | | |
481 | 540 | | |
482 | 541 | | |
483 | | - | |
| 542 | + | |
484 | 543 | | |
485 | 544 | | |
486 | 545 | | |
| |||
503 | 562 | | |
504 | 563 | | |
505 | 564 | | |
506 | | - | |
| 565 | + | |
507 | 566 | | |
508 | 567 | | |
509 | 568 | | |
| |||
0 commit comments