-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Dark mode for CupertinoSwitch and CupertinoScrollbar, Fidelity updates #40636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dark mode for CupertinoSwitch and CupertinoScrollbar, Fidelity updates #40636
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hash is a placeholder.
| } | ||
|
|
||
| final CupertinoThumbPainter _thumbPainter = CupertinoThumbPainter(); | ||
| final CupertinoThumbPainter _thumbPainter = const CupertinoThumbPainter.switchThumb(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just substitute const CupertinoThumbPainter.switchThumb(); for _thumbPainter below?
|
|
||
| import '../rendering/mock_canvas.dart'; | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Extra blank line
5608e22 to
6a93dd5
Compare
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Have you seen #37312 and does this fix that as well?
| } | ||
|
|
||
| final CupertinoThumbPainter _thumbPainter = CupertinoThumbPainter(); | ||
| final CupertinoThumbPainter _thumbPainter = const CupertinoThumbPainter.switchThumb(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after the colon
| _painter ??= _buildCupertinoScrollbarPainter(context); | ||
| _painter | ||
| ..textDirection = Directionality.of(context) | ||
| ..color = CupertinoDynamicColor.resolve(_kScrollbarColor, context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NICE
| } | ||
|
|
||
| final CupertinoThumbPainter _thumbPainter = CupertinoThumbPainter(); | ||
| final CupertinoThumbPainter _thumbPainter = const CupertinoThumbPainter.switchThumb(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just substitute const CupertinoThumbPainter.switchThumb(); for _thumbPainter below?
| set textDirection(TextDirection value) { | ||
| assert(value != null); | ||
| if (textDirection == value) | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two space indent
brandondiamond
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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?