-
Notifications
You must be signed in to change notification settings - Fork 346
theme: Implement DesignVariables.dark #804
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
Conversation
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.
Exciting!
Let's take this as a prompt to add a quick set of smoke-tests of the lerp method here, from light to dark etc. to check that they don't blow up, same as was done recently for CodeBlockTextStyles.
lib/widgets/theme.dart
Outdated
| factory DesignVariables.light() { | ||
| return DesignVariables._( |
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: can simplify slightly:
| factory DesignVariables.light() { | |
| return DesignVariables._( | |
| DesignVariables.light() : | |
| this._( |
That's a Dart "redirecting constructor":
https://dart.dev/language/constructors#redirecting-constructors
660938a to
ab1c17c
Compare
|
Thanks for the review! Revision pushed. I've also added some stream-colors test coverage that's meant to be added here: |
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.
Thanks! Two small comments; then please go ahead and merge.
| return const Placeholder(); | ||
| }))); | ||
| await tester.pumpAndSettle(); | ||
| debugFollowPlatformBrightness = true; |
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.
should also get an addTearDown call to reset
test/widgets/theme_test.dart
Outdated
| doTest('light', 0xff76ce90, StreamColorSwatch.light(0xff76ce90)); | ||
| // TODO(#95) test with Brightness.dark and lerping between light/dark | ||
| await tester.pump(kThemeAnimationDuration * 0.6); | ||
| check(colorSwatchFor(element, subscription)).equals(StreamColorSwatch.dark(baseColor)); |
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: wrap line, also making parallel to the light case above
| check(colorSwatchFor(element, subscription)).equals(StreamColorSwatch.dark(baseColor)); | |
| check(colorSwatchFor(element, subscription)) | |
| .equals(StreamColorSwatch.dark(baseColor)); |
Then might as well make the intermediate case parallel too: inline expectedLerped, and format the same way, like
check(colorSwatchFor(element, subscription))
.equals(StreamColorSwatch.lerp(| final element = tester.element(find.byType(Placeholder)); | ||
| // Compares all the swatch's members; see [ColorSwatch]'s `operator ==`. | ||
| check(colorSwatchFor(element, subscription)) |
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.
Neat!
For how I retrieved the current list of variables, see zulip#762 (comment) .
We can check the dark and lerped states conveniently without using this helper.
ab1c17c to
af2e178
Compare
|
Thanks! Done. |
No description provided.