@@ -6,7 +6,6 @@ import '../model/narrow.dart';
6
6
import '../model/recent_dm_conversations.dart' ;
7
7
import '../model/unreads.dart' ;
8
8
import 'action_sheet.dart' ;
9
- import 'channel_colors.dart' ;
10
9
import 'icons.dart' ;
11
10
import 'message_list.dart' ;
12
11
import 'page.dart' ;
@@ -250,7 +249,9 @@ abstract class _HeaderItem extends StatelessWidget {
250
249
Color collapsedIconColor (BuildContext context);
251
250
Color uncollapsedIconColor (BuildContext context);
252
251
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;
254
255
255
256
Future <void > onCollapseButtonTap () async {
256
257
if (! collapsed) {
@@ -308,7 +309,7 @@ abstract class _HeaderItem extends StatelessWidget {
308
309
if (hasMention) const _IconMarker (icon: ZulipIcons .at_sign),
309
310
Padding (padding: const EdgeInsetsDirectional .only (end: 16 ),
310
311
child: UnreadCountBadge (
311
- backgroundColor : unreadCountBadgeBackgroundColor (context) ,
312
+ channelIdForBackground : channelId ,
312
313
bold: true ,
313
314
count: count)),
314
315
])));
@@ -333,7 +334,7 @@ class _AllDmsHeaderItem extends _HeaderItem {
333
334
@override Color uncollapsedIconColor (context) => DesignVariables .of (context).labelMenuButton;
334
335
335
336
@override Color uncollapsedBackgroundColor (context) => DesignVariables .of (context).dmHeaderBg;
336
- @override ChannelColorSwatch ? unreadCountBadgeBackgroundColor (context) => null ;
337
+ @override int ? get channelId => null ;
337
338
338
339
@override Future <void > onCollapseButtonTap () async {
339
340
await super .onCollapseButtonTap ();
@@ -430,8 +431,7 @@ class _DmItem extends StatelessWidget {
430
431
const SizedBox (width: 12 ),
431
432
if (hasMention) const _IconMarker (icon: ZulipIcons .at_sign),
432
433
Padding (padding: const EdgeInsetsDirectional .only (end: 16 ),
433
- child: UnreadCountBadge (backgroundColor: null ,
434
- count: count)),
434
+ child: UnreadCountBadge (count: count)),
435
435
]))));
436
436
}
437
437
}
@@ -463,8 +463,7 @@ class _StreamHeaderItem extends _HeaderItem with _LongPressable {
463
463
colorSwatchFor (context, subscription).iconOnBarBackground;
464
464
@override Color uncollapsedBackgroundColor (context) =>
465
465
colorSwatchFor (context, subscription).barBackground;
466
- @override ChannelColorSwatch ? unreadCountBadgeBackgroundColor (context) =>
467
- colorSwatchFor (context, subscription);
466
+ @override int ? get channelId => subscription.streamId;
468
467
469
468
@override Future <void > onCollapseButtonTap () async {
470
469
await super .onCollapseButtonTap ();
@@ -527,7 +526,6 @@ class _TopicItem extends StatelessWidget {
527
526
: topic, : count, : hasMention, : lastUnreadId) = data;
528
527
529
528
final store = PerAccountStoreWidget .of (context);
530
- final subscription = store.subscriptions[streamId]! ;
531
529
532
530
final designVariables = DesignVariables .of (context);
533
531
final visibilityIcon = iconDataForTopicVisibilityPolicy (
@@ -567,7 +565,7 @@ class _TopicItem extends StatelessWidget {
567
565
if (visibilityIcon != null ) _IconMarker (icon: visibilityIcon),
568
566
Padding (padding: const EdgeInsetsDirectional .only (end: 16 ),
569
567
child: UnreadCountBadge (
570
- backgroundColor : colorSwatchFor (context, subscription) ,
568
+ channelIdForBackground : streamId ,
571
569
count: count)),
572
570
]))));
573
571
}
0 commit comments