@@ -132,23 +132,28 @@ class _InboxPageState extends State<InboxPageBody> with PerAccountStoreAwareStat
132
132
});
133
133
134
134
for (final MapEntry (key: streamId, value: topics) in sortedUnreadStreams) {
135
- final topicItems = < ( TopicName , int , bool , int ) > [];
135
+ final topicItems = < _StreamSectionTopicData > [];
136
136
int countInStream = 0 ;
137
137
bool streamHasMention = false ;
138
138
for (final MapEntry (key: topic, value: messageIds) in topics.entries) {
139
139
if (! store.isTopicVisible (streamId, topic)) continue ;
140
140
final countInTopic = messageIds.length;
141
141
final hasMention = messageIds.any ((messageId) => unreadsModel! .mentions.contains (messageId));
142
142
if (hasMention) streamHasMention = true ;
143
- topicItems.add ((topic, countInTopic, hasMention, messageIds.last));
143
+ topicItems.add (_StreamSectionTopicData (
144
+ topic: topic,
145
+ count: countInTopic,
146
+ hasMention: hasMention,
147
+ lastUnreadId: messageIds.last,
148
+ ));
144
149
countInStream += countInTopic;
145
150
}
146
151
if (countInStream == 0 ) {
147
152
continue ;
148
153
}
149
154
topicItems.sort ((a, b) {
150
- final (_, _, _, aLastUnreadId) = a;
151
- final (_, _, _, bLastUnreadId) = b;
155
+ final aLastUnreadId = a.lastUnreadId ;
156
+ final bLastUnreadId = b.lastUnreadId ;
152
157
return bLastUnreadId.compareTo (aLastUnreadId);
153
158
});
154
159
sections.add (_StreamSectionData (streamId, countInStream, streamHasMention, topicItems));
@@ -192,11 +197,25 @@ class _StreamSectionData extends _InboxSectionData {
192
197
final int streamId;
193
198
final int count;
194
199
final bool hasMention;
195
- final List <( TopicName , int , bool , int ) > items;
200
+ final List <_StreamSectionTopicData > items;
196
201
197
202
const _StreamSectionData (this .streamId, this .count, this .hasMention, this .items);
198
203
}
199
204
205
+ class _StreamSectionTopicData {
206
+ final TopicName topic;
207
+ final int count;
208
+ final bool hasMention;
209
+ final int lastUnreadId;
210
+
211
+ const _StreamSectionTopicData ({
212
+ required this .topic,
213
+ required this .count,
214
+ required this .hasMention,
215
+ required this .lastUnreadId,
216
+ });
217
+ }
218
+
200
219
abstract class _HeaderItem extends StatelessWidget {
201
220
final bool collapsed;
202
221
final _InboxPageState pageState;
@@ -466,7 +485,7 @@ class _StreamSection extends StatelessWidget {
466
485
child: Column (children: [
467
486
header,
468
487
if (! collapsed) ...data.items.map ((item) {
469
- final ( topic, count, hasMention, _ ) = item;
488
+ final _StreamSectionTopicData ( : topic, : count, : hasMention) = item;
470
489
return _TopicItem (
471
490
streamId: data.streamId,
472
491
topic: topic,
0 commit comments