@@ -134,10 +134,12 @@ class _InboxPageState extends State<InboxPage> with PerAccountStoreAwareStateMix
134
134
for (final MapEntry (key: streamId, value: topics) in sortedUnreadStreams) {
135
135
final topicItems = < (String , int , bool , int )> [];
136
136
int countInStream = 0 ;
137
+ bool streamHasMention = false ;
137
138
for (final MapEntry (key: topic, value: messageIds) in topics.entries) {
138
139
if (! store.isTopicVisible (streamId, topic)) continue ;
139
140
final countInTopic = messageIds.length;
140
141
final hasMention = messageIds.any ((messageId) => unreadsModel! .mentions.contains (messageId));
142
+ if (hasMention) streamHasMention = true ;
141
143
topicItems.add ((topic, countInTopic, hasMention, messageIds.last));
142
144
countInStream += countInTopic;
143
145
}
@@ -149,7 +151,7 @@ class _InboxPageState extends State<InboxPage> with PerAccountStoreAwareStateMix
149
151
final (_, _, _, bLastUnreadId) = b;
150
152
return bLastUnreadId.compareTo (aLastUnreadId);
151
153
});
152
- sections.add (_StreamSectionData (streamId, countInStream, topicItems));
154
+ sections.add (_StreamSectionData (streamId, countInStream, streamHasMention, topicItems));
153
155
}
154
156
155
157
return Scaffold (
@@ -190,20 +192,23 @@ class _AllDmsSectionData extends _InboxSectionData {
190
192
class _StreamSectionData extends _InboxSectionData {
191
193
final int streamId;
192
194
final int count;
195
+ final bool hasMention;
193
196
final List <(String , int , bool , int )> items;
194
197
195
- const _StreamSectionData (this .streamId, this .count, this .items);
198
+ const _StreamSectionData (this .streamId, this .count, this .hasMention, this . items);
196
199
}
197
200
198
201
abstract class _HeaderItem extends StatelessWidget {
199
202
final bool collapsed;
200
203
final _InboxPageState pageState;
201
204
final int count;
205
+ final bool hasMention;
202
206
203
207
const _HeaderItem ({
204
208
required this .collapsed,
205
209
required this .pageState,
206
210
required this .count,
211
+ required this .hasMention,
207
212
});
208
213
209
214
String get title;
@@ -247,7 +252,7 @@ abstract class _HeaderItem extends StatelessWidget {
247
252
overflow: TextOverflow .ellipsis,
248
253
title))),
249
254
const SizedBox (width: 12 ),
250
- // TODO(#384) for streams, show @-mention indicator when it applies
255
+ if (hasMention) const _AtMentionMarker (),
251
256
Padding (padding: const EdgeInsetsDirectional .only (end: 16 ),
252
257
child: UnreadCountBadge (backgroundColor: unreadCountBadgeBackgroundColor, bold: true ,
253
258
count: count)),
@@ -260,6 +265,7 @@ class _AllDmsHeaderItem extends _HeaderItem {
260
265
required super .collapsed,
261
266
required super .pageState,
262
267
required super .count,
268
+ required super .hasMention,
263
269
});
264
270
265
271
@override get title => 'Direct messages' ; // TODO(i18n)
@@ -290,6 +296,7 @@ class _AllDmsSection extends StatelessWidget {
290
296
Widget build (BuildContext context) {
291
297
final header = _AllDmsHeaderItem (
292
298
count: data.count,
299
+ hasMention: false ,
293
300
collapsed: collapsed,
294
301
pageState: pageState,
295
302
);
@@ -369,6 +376,7 @@ class _StreamHeaderItem extends _HeaderItem {
369
376
required super .collapsed,
370
377
required super .pageState,
371
378
required super .count,
379
+ required super .hasMention,
372
380
});
373
381
374
382
@override get title => subscription.name;
@@ -407,6 +415,7 @@ class _StreamSection extends StatelessWidget {
407
415
final header = _StreamHeaderItem (
408
416
subscription: subscription,
409
417
count: data.count,
418
+ hasMention: data.hasMention,
410
419
collapsed: collapsed,
411
420
pageState: pageState,
412
421
);
0 commit comments