Skip to content

Commit 7446241

Browse files
committed
inbox [nfc]: Pass new data class to topic-item widget
Instead of passing its fields separately. (We'd like to start using lastUnreadId from the data too.)
1 parent 6b005df commit 7446241

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

lib/widgets/inbox.dart

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -485,33 +485,22 @@ class _StreamSection extends StatelessWidget {
485485
child: Column(children: [
486486
header,
487487
if (!collapsed) ...data.items.map((item) {
488-
final _StreamSectionTopicData(:topic, :count, :hasMention) = item;
489-
return _TopicItem(
490-
streamId: data.streamId,
491-
topic: topic,
492-
count: count,
493-
hasMention: hasMention,
494-
);
488+
return _TopicItem(streamId: data.streamId, data: item);
495489
}),
496490
]));
497491
}
498492
}
499493

500494
class _TopicItem extends StatelessWidget {
501-
const _TopicItem({
502-
required this.streamId,
503-
required this.topic,
504-
required this.count,
505-
required this.hasMention,
506-
});
495+
const _TopicItem({required this.streamId, required this.data});
507496

508497
final int streamId;
509-
final TopicName topic;
510-
final int count;
511-
final bool hasMention;
498+
final _StreamSectionTopicData data;
512499

513500
@override
514501
Widget build(BuildContext context) {
502+
final _StreamSectionTopicData(:topic, :count, :hasMention) = data;
503+
515504
final store = PerAccountStoreWidget.of(context);
516505
final subscription = store.subscriptions[streamId]!;
517506

0 commit comments

Comments
 (0)