Skip to content

Conversation

chrisbobbe
Copy link
Collaborator

Before After
image image
image image

cc @alya

@chrisbobbe chrisbobbe added the maintainer review PR ready for review by Zulip maintainers label Oct 2, 2025
Copy link
Member

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

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

Thanks @chrisbobbe! LGTM and tests great. Over to Greg's review.

@rajveermalviya rajveermalviya 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 Oct 6, 2025
@rajveermalviya rajveermalviya requested a review from gnprice October 6, 2025 15:36
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 @chrisbobbe for the fix, and thanks @rajveermalviya for testing it! Two nits below; otherwise all looks good.

super.key,
required this.count,
required this.backgroundColor,
this.channelIdForBackground,
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps keep this required? I think "use the not-in-a-channel coloring" isn't necessarily a good default, even though it's represented by null.

Comment on lines 56 to 60
await prepare(tester,
child: UnreadCountBadge(
count: 1,
channelIdForBackground: subscription.streamId),
subscription: subscription);
Copy link
Member

Choose a reason for hiding this comment

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

nit: subscription before child; logically it comes first (it gets applied first), plus the child is a longer argument in the source code

UnreadCountBadge has a needlessly loose API for specifying a
background color, with three options:

1. Channel-colorized: callers are supposed to pass a
   ChannelColorSwatch and the implementation picks
   `unreadCountBadgeBackground` off of that.
2. Any other Color. (ChannelColorSwatch is a Color.)
3. A default color, chosen by the implementation, if `null` is
   passed.

We don't actually have any use for option 2, at least currently, so
we'll remove it next.

The buggy caller here was using option 2 when it should have used
option 1: it wanted a channel-colored background, but it itself
picked `unreadCountBadgeBackground` off of the swatch instead of
passing the whole swatch to UnreadCountBadge for it to do that. That
would have been fine except that the channel-colorized case has its
own associated *text* color, and that's conditioned on whether the
passed background color is a ChannelColorSwatch.
Previously, this widget had three options for the background color:

1. Colorized for a channel: callers could pass a ChannelColorSwatch,
   and the implementation would pick `unreadCountBadgeBackground` off
   of that.
2. Any `Color`.
3. A default, chosen by the implementation.

One caller was using option 2 when option 1 would be a better fit:
it wanted a channel-colored background, but it was picking
`unreadCountBadgeBackground` itself from the ChannelColorSwatch
instead of letting the implementation do that.

After changing that caller to just pass the ChannelColorSwatch
(option 1), no more callers use option 2, so we remove it. Now
UnreadCountBadge has a tighter interface.

Next we'll encapsulate finding the channel color swatch itself, so
callers only need to have a channel ID if they want a
channel-colored background.
@chrisbobbe chrisbobbe force-pushed the pr-inbox-channel-unread-badge-text-color branch from 9edefdb to ce945d0 Compare October 7, 2025 20:22
@chrisbobbe
Copy link
Collaborator Author

Thanks for the review! Revision pushed.

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