Skip to content

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

Merged
merged 5 commits into from
Jul 16, 2024

Conversation

chrisbobbe
Copy link
Collaborator

No description provided.

@chrisbobbe chrisbobbe requested a review from gnprice July 11, 2024 23:48
@chrisbobbe chrisbobbe added the integration review Added by maintainers when PR may be ready for integration label Jul 12, 2024
Copy link
Member

@gnprice gnprice left a 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.

Comment on lines 78 to 79
factory DesignVariables.light() {
return DesignVariables._(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can simplify slightly:

Suggested change
factory DesignVariables.light() {
return DesignVariables._(
DesignVariables.light() :
this._(

That's a Dart "redirecting constructor":
https://dart.dev/language/constructors#redirecting-constructors

@chrisbobbe
Copy link
Collaborator Author

Thanks for the review! Revision pushed. I've also added some stream-colors test coverage that's meant to be added here:

// TODO(#95) test with Brightness.dark and lerping between light/dark

Copy link
Member

@gnprice gnprice left a 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;
Copy link
Member

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

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));
Copy link
Member

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

Suggested change
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(

Comment on lines +127 to +131
final element = tester.element(find.byType(Placeholder));
// Compares all the swatch's members; see [ColorSwatch]'s `operator ==`.
check(colorSwatchFor(element, subscription))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat!

@chrisbobbe chrisbobbe force-pushed the pr-design-variables-dark branch from ab1c17c to af2e178 Compare July 16, 2024 23:26
@chrisbobbe chrisbobbe merged commit af2e178 into zulip:main Jul 16, 2024
1 check passed
@chrisbobbe chrisbobbe deleted the pr-design-variables-dark branch July 16, 2024 23:36
@chrisbobbe
Copy link
Collaborator Author

Thanks! Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants