@@ -255,6 +255,14 @@ void showTopicActionSheet(BuildContext context, {
255255 someMessageIdInTopic: someMessageIdInTopic));
256256 }
257257
258+ final unreadCount = store.unreads.countInTopicNarrow (channelId, topic);
259+ if (unreadCount > 0 ) {
260+ optionButtons.add (MarkTopicAsReadButton (
261+ channelId: channelId,
262+ topic: topic,
263+ pageContext: context));
264+ }
265+
258266 if (optionButtons.isEmpty) {
259267 // TODO(a11y): This case makes a no-op gesture handler; as a consequence,
260268 // we're presenting some UI (to people who use screen-reader software) as
@@ -461,6 +469,29 @@ class ResolveUnresolveButton extends ActionSheetMenuItemButton {
461469 }
462470}
463471
472+ class MarkTopicAsReadButton extends ActionSheetMenuItemButton {
473+ const MarkTopicAsReadButton ({
474+ super .key,
475+ required this .channelId,
476+ required this .topic,
477+ required super .pageContext,
478+ });
479+
480+ final int channelId;
481+ final TopicName topic;
482+
483+ @override IconData get icon => ZulipIcons .message_checked;
484+
485+ @override
486+ String label (ZulipLocalizations zulipLocalizations) {
487+ return zulipLocalizations.actionSheetOptionMarkTopicAsRead;
488+ }
489+
490+ @override void onPressed () async {
491+ await ZulipAction .markNarrowAsRead (pageContext, TopicNarrow (channelId, topic));
492+ }
493+ }
494+
464495/// Show a sheet of actions you can take on a message in the message list.
465496///
466497/// Must have a [MessageListPage] ancestor.
0 commit comments