@@ -240,6 +240,14 @@ void showTopicActionSheet(BuildContext context, {
240
240
pageContext: context);
241
241
}));
242
242
243
+ final unreadCount = store.unreads.countInTopicNarrow (channelId, topic);
244
+ if (unreadCount > 0 ) {
245
+ optionButtons.add (MarkTopicAsReadButton (
246
+ channelId: channelId,
247
+ topic: topic,
248
+ pageContext: context));
249
+ }
250
+
243
251
if (optionButtons.isEmpty) {
244
252
// TODO(a11y): This case makes a no-op gesture handler; as a consequence,
245
253
// we're presenting some UI (to people who use screen-reader software) as
@@ -372,6 +380,30 @@ class UserTopicUpdateButton extends ActionSheetMenuItemButton {
372
380
}
373
381
}
374
382
383
+ class MarkTopicAsReadButton extends ActionSheetMenuItemButton {
384
+ const MarkTopicAsReadButton ({
385
+ super .key,
386
+ required this .channelId,
387
+ required this .topic,
388
+ required super .pageContext,
389
+ });
390
+
391
+ final int channelId;
392
+ final TopicName topic;
393
+
394
+ @override IconData get icon => ZulipIcons .message_checked;
395
+
396
+ @override
397
+ String label (ZulipLocalizations zulipLocalizations) {
398
+ return zulipLocalizations.actionSheetOptionMarkTopicAsRead;
399
+ }
400
+
401
+ @override void onPressed () async {
402
+ if (! pageContext.mounted) return ;
403
+ await markNarrowAsRead (pageContext, TopicNarrow (channelId, topic));
404
+ }
405
+ }
406
+
375
407
/// Show a sheet of actions you can take on a message in the message list.
376
408
///
377
409
/// Must have a [MessageListPage] ancestor.
0 commit comments