Skip to content
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

Make {MessageList,EmojiReaction}Theme.{light,dark} static final fields #1276

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chrisbobbe
Copy link
Collaborator

Followup to #1236 (comment):

We should be able to apply this to MessageListTheme and etc., right?

We can, for MessageListTheme and EmojiReactionTheme, but not for ContentTheme because the light and dark variants need a BuildContext.

@chrisbobbe chrisbobbe added the maintainer review PR ready for review by Zulip maintainers label Jan 13, 2025
@chrisbobbe chrisbobbe requested a review from PIG208 January 13, 2025 19:37
Copy link
Member

@PIG208 PIG208 left a comment

Choose a reason for hiding this comment

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

Thanks! I did a quick grep for the old variable names (for the final commit) and found no hanging references in comments. This LGTM.

@@ -38,91 +38,91 @@ import 'text.dart';
class ContentTheme extends ThemeExtension<ContentTheme> {
Copy link
Member

Choose a reason for hiding this comment

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

nit: perhaps it's intentional, but don't we usually use content: for the commit summary of changes like this?

@PIG208 PIG208 assigned gnprice and unassigned PIG208 Jan 15, 2025
@PIG208 PIG208 added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Jan 15, 2025
@chrisbobbe chrisbobbe force-pushed the pr-theme-extension-final-fields branch from 022119e to 110e8c4 Compare January 15, 2025 21:09
@chrisbobbe
Copy link
Collaborator Author

Thanks for the review! Revision pushed, and I see you've marked for Greg's review.

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! Comment below; otherwise looks good.

Comment on lines 1094 to 1095
style: widget.style
.merge(ContentTheme.of(_context!).textStyleInlineCode)
.merge(ContentTheme.of(_context!).inlineCode)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about this last commit. It feels confusing to me to have some of these be colors and others text styles and not have any identification of which is which — you can't really guess from the names, as it's arbitrary that e.g. pollNames is only a color while inlineCode is a style. (The poll names are text just as much as the inline code is.)

It's true that the types are distinct and so the type-checker will prevent any real disasters. But it's useful to be able to read and understand the code without having to go track down (or consult the IDE about) the types of things all the time.

The other theme classes don't have this issue because they're entirely colors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, yeah I don't mind dropping the last commit :)

Instead of constructors. Nicer to compute each of these just once.

Like we did for DesignVariables in dcc8123.
Like we did for MessageListTheme in the previous commit and
DesignVariables in dcc8123.
@chrisbobbe chrisbobbe force-pushed the pr-theme-extension-final-fields branch from 110e8c4 to 34b31da Compare January 18, 2025 00:09
@chrisbobbe
Copy link
Collaborator Author

Thanks for the review! Revision pushed, atop #1290 for the sake of CI.

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.

3 participants