Dark mode for CupertinoSwitch and CupertinoScrollbar, Fidelity updates#40636
Dark mode for CupertinoSwitch and CupertinoScrollbar, Fidelity updates#40636LongCatIsLooong merged 18 commits intoflutter:masterfrom
Conversation
|
It looks like this pull request includes a golden file change. Please make sure to follow Handling Breaking Changes. While there are exceptions to this rule, if this patch modifies an existing golden file, it is probably not an exception. Only new golden files are not considered breaking changes. Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
bin/internal/goldens.version
Outdated
| @@ -1 +1 @@ | |||
| ae7615ce466a548b41a0f7b9860ec453646f73e9 | |||
| aec919aee765d460a3dbe457e81c29e0a2221334 | |||
There was a problem hiding this comment.
This hash is a placeholder.
| } | ||
|
|
||
| final CupertinoThumbPainter _thumbPainter = CupertinoThumbPainter(); | ||
| final CupertinoThumbPainter _thumbPainter = const CupertinoThumbPainter.switchThumb(); |
There was a problem hiding this comment.
Interestingly the analyzer doesn't seem to have an opinion about the const. I assume const CupertinoThumbPainter.switchThumb() is different from CupertinoThumbPainter.switchThumb() and the former should be preferred?
There was a problem hiding this comment.
Weird, I'm curious as to why. Definitely better to err on the side of including the const though.
There was a problem hiding this comment.
Why not just substitute const CupertinoThumbPainter.switchThumb(); for _thumbPainter below?
|
|
||
| import '../rendering/mock_canvas.dart'; | ||
|
|
||
|
|
5608e22 to
6a93dd5
Compare
| } | ||
|
|
||
| final CupertinoThumbPainter _thumbPainter = CupertinoThumbPainter(); | ||
| final CupertinoThumbPainter _thumbPainter = const CupertinoThumbPainter.switchThumb(); |
There was a problem hiding this comment.
Weird, I'm curious as to why. Definitely better to err on the side of including the const though.
|
@justinmc I believe it does: flutter/goldens#45. Updated the description to include that issue. Thanks for bringing it up! 👍 |
HansMuller
left a comment
There was a problem hiding this comment.
LGTM with a few small changes
| // Extracted from iOS 13.1 beta using Debug View Hierarchy. | ||
| const Color _kScrollbarColor = CupertinoDynamicColor.withBrightness( | ||
| color: Color(0x59000000), | ||
| darkColor:Color(0x80FFFFFF), |
| _painter ??= _buildCupertinoScrollbarPainter(context); | ||
| _painter | ||
| ..textDirection = Directionality.of(context) | ||
| ..color = CupertinoDynamicColor.resolve(_kScrollbarColor, context); |
There was a problem hiding this comment.
Need to update the painter's padding too, since it depends on MediaQuery.of(context).
|
|
||
| final Offset thumbCenter = Offset(trackActive, trackCenter); | ||
| _thumbPainter.paint(canvas, Rect.fromCircle(center: thumbCenter, radius: CupertinoThumbPainter.radius)); | ||
| const CupertinoThumbPainter().paint(canvas, Rect.fromCircle(center: thumbCenter, radius: CupertinoThumbPainter.radius)); |
| } | ||
|
|
||
| final CupertinoThumbPainter _thumbPainter = CupertinoThumbPainter(); | ||
| final CupertinoThumbPainter _thumbPainter = const CupertinoThumbPainter.switchThumb(); |
There was a problem hiding this comment.
Why not just substitute const CupertinoThumbPainter.switchThumb(); for _thumbPainter below?
| set textDirection(TextDirection value) { | ||
| assert(value != null); | ||
| if (textDirection == value) | ||
| return; |
Description
Dark mode and fidelity updates. This change breaks goldens and the API of
CupertinoThumbPainter.Golden updates: flutter/goldens#45
Screenshots
Comparison
Dark Mode
activeOrangewill be replaced onceCupertinoThemeis updated. For now please bear with the wrong slider track color.Related Issues
part of #35541
Fixes #37312
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?