@@ -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,8 +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- count: count)),
434+ child: UnreadCountBadge (count: count)),
435435 ]))));
436436 }
437437}
@@ -463,8 +463,7 @@ class _StreamHeaderItem extends _HeaderItem with _LongPressable {
463463 colorSwatchFor (context, subscription).iconOnBarBackground;
464464 @override Color uncollapsedBackgroundColor (context) =>
465465 colorSwatchFor (context, subscription).barBackground;
466- @override ChannelColorSwatch ? unreadCountBadgeBackgroundColor (context) =>
467- colorSwatchFor (context, subscription);
466+ @override int ? get channelId => subscription.streamId;
468467
469468 @override Future <void > onCollapseButtonTap () async {
470469 await super .onCollapseButtonTap ();
@@ -527,7 +526,6 @@ class _TopicItem extends StatelessWidget {
527526 : topic, : count, : hasMention, : lastUnreadId) = data;
528527
529528 final store = PerAccountStoreWidget .of (context);
530- final subscription = store.subscriptions[streamId]! ;
531529
532530 final designVariables = DesignVariables .of (context);
533531 final visibilityIcon = iconDataForTopicVisibilityPolicy (
@@ -567,7 +565,7 @@ class _TopicItem extends StatelessWidget {
567565 if (visibilityIcon != null ) _IconMarker (icon: visibilityIcon),
568566 Padding (padding: const EdgeInsetsDirectional .only (end: 16 ),
569567 child: UnreadCountBadge (
570- backgroundColor : colorSwatchFor (context, subscription) ,
568+ channelIdForBackground : streamId ,
571569 count: count)),
572570 ]))));
573571 }
0 commit comments