@@ -6,7 +6,6 @@ import '../model/narrow.dart';
66import '../model/recent_dm_conversations.dart' ;
77import '../model/unreads.dart' ;
88import 'action_sheet.dart' ;
9- import 'channel_colors.dart' ;
109import 'icons.dart' ;
1110import 'message_list.dart' ;
1211import 'page.dart' ;
@@ -250,7 +249,9 @@ abstract class _HeaderItem extends StatelessWidget {
250249 Color collapsedIconColor (BuildContext context);
251250 Color uncollapsedIconColor (BuildContext context);
252251 Color uncollapsedBackgroundColor (BuildContext context);
253- ChannelColorSwatch ? unreadCountBadgeBackgroundColor (BuildContext context);
252+
253+ /// A channel ID, if this represents a channel, else null.
254+ int ? get channelId;
254255
255256 Future <void > onCollapseButtonTap () async {
256257 if (! collapsed) {
@@ -308,7 +309,7 @@ abstract class _HeaderItem extends StatelessWidget {
308309 if (hasMention) const _IconMarker (icon: ZulipIcons .at_sign),
309310 Padding (padding: const EdgeInsetsDirectional .only (end: 16 ),
310311 child: UnreadCountBadge (
311- backgroundColor : unreadCountBadgeBackgroundColor (context) ,
312+ channelIdForBackground : channelId ,
312313 bold: true ,
313314 count: count)),
314315 ])));
@@ -333,7 +334,7 @@ class _AllDmsHeaderItem extends _HeaderItem {
333334 @override Color uncollapsedIconColor (context) => DesignVariables .of (context).labelMenuButton;
334335
335336 @override Color uncollapsedBackgroundColor (context) => DesignVariables .of (context).dmHeaderBg;
336- @override ChannelColorSwatch ? unreadCountBadgeBackgroundColor (context) => null ;
337+ @override int ? get channelId => null ;
337338
338339 @override Future <void > onCollapseButtonTap () async {
339340 await super .onCollapseButtonTap ();
@@ -430,7 +431,7 @@ class _DmItem extends StatelessWidget {
430431 const SizedBox (width: 12 ),
431432 if (hasMention) const _IconMarker (icon: ZulipIcons .at_sign),
432433 Padding (padding: const EdgeInsetsDirectional .only (end: 16 ),
433- child: UnreadCountBadge (backgroundColor : null ,
434+ child: UnreadCountBadge (channelIdForBackground : null ,
434435 count: count)),
435436 ]))));
436437 }
@@ -463,8 +464,7 @@ class _StreamHeaderItem extends _HeaderItem with _LongPressable {
463464 colorSwatchFor (context, subscription).iconOnBarBackground;
464465 @override Color uncollapsedBackgroundColor (context) =>
465466 colorSwatchFor (context, subscription).barBackground;
466- @override ChannelColorSwatch ? unreadCountBadgeBackgroundColor (context) =>
467- colorSwatchFor (context, subscription);
467+ @override int ? get channelId => subscription.streamId;
468468
469469 @override Future <void > onCollapseButtonTap () async {
470470 await super .onCollapseButtonTap ();
@@ -527,7 +527,6 @@ class _TopicItem extends StatelessWidget {
527527 : topic, : count, : hasMention, : lastUnreadId) = data;
528528
529529 final store = PerAccountStoreWidget .of (context);
530- final subscription = store.subscriptions[streamId]! ;
531530
532531 final designVariables = DesignVariables .of (context);
533532 final visibilityIcon = iconDataForTopicVisibilityPolicy (
@@ -567,7 +566,7 @@ class _TopicItem extends StatelessWidget {
567566 if (visibilityIcon != null ) _IconMarker (icon: visibilityIcon),
568567 Padding (padding: const EdgeInsetsDirectional .only (end: 16 ),
569568 child: UnreadCountBadge (
570- backgroundColor : colorSwatchFor (context, subscription) ,
569+ channelIdForBackground : streamId ,
571570 count: count)),
572571 ]))));
573572 }
0 commit comments