@@ -34,10 +34,14 @@ import 'text.dart';
3434import 'theme.dart' ;
3535import 'topic_list.dart' ;
3636
37- void _showActionSheet (
37+ /// Shows a "context menu" in the style of the Figma component with that name.
38+ ///
39+ /// See Figma:
40+ /// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3479-26262&m=dev
41+ void _showContextMenu (
3842 BuildContext pageContext, {
3943 Widget ? header,
40- required List <Widget > optionButtons ,
44+ required List <Widget > buttons ,
4145}) {
4246 // Could omit this if we need _showActionSheet outside a per-account context.
4347 final accountId = PerAccountStoreWidget .accountIdOf (pageContext);
@@ -91,21 +95,21 @@ void _showActionSheet(
9195 color: designVariables.bgContextMenu,
9296 child: SingleChildScrollView (
9397 padding: const EdgeInsets .symmetric (vertical: 8 ),
94- child: MenuButtonsShape (buttons: optionButtons )))),
98+ child: MenuButtonsShape (buttons: buttons )))),
9599 const BottomSheetDismissButton (style: BottomSheetDismissButtonStyle .cancel),
96100 ]))),
97101 ]))));
98102 });
99103}
100104
101- /// A header for a bottom sheet with a multiline UI string.
105+ /// A header for a context menu with a multiline UI string.
102106///
103107/// Assumes 8px padding below the top of the bottom sheet.
104108///
105109/// Figma:
106110/// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3481-26993&m=dev
107- class BottomSheetHeaderPlainText extends StatelessWidget {
108- const BottomSheetHeaderPlainText ({super .key, required this .text});
111+ class ContextMenuHeaderPlainText extends StatelessWidget {
112+ const ContextMenuHeaderPlainText ({super .key, required this .text});
109113
110114 final String text;
111115
@@ -126,7 +130,7 @@ class BottomSheetHeaderPlainText extends StatelessWidget {
126130 }
127131}
128132
129- /// A button in an action sheet .
133+ /// A button in a context menu .
130134///
131135/// When built from server data, the action sheet ignores changes in that data;
132136/// we intentionally don't live-update the buttons on events.
@@ -140,8 +144,8 @@ class BottomSheetHeaderPlainText extends StatelessWidget {
140144/// (Even if we did live-update the buttons, it's possible anyway that a user's
141145/// action can race with a change that's already been applied on the server,
142146/// because it takes some time for the server to report changes to us.)
143- abstract class ActionSheetMenuItemButton extends StatelessWidget {
144- const ActionSheetMenuItemButton ({super .key, required this .pageContext});
147+ abstract class ContextMenuItemButton extends StatelessWidget {
148+ const ContextMenuItemButton ({super .key, required this .pageContext});
145149
146150 IconData get icon;
147151 String label (ZulipLocalizations zulipLocalizations);
@@ -241,24 +245,24 @@ void showChannelActionSheet(BuildContext context, {
241245 final pageContext = PageRoot .contextOf (context);
242246 final store = PerAccountStoreWidget .of (pageContext);
243247
244- final optionButtons = < ActionSheetMenuItemButton > [];
248+ final buttons = < ContextMenuItemButton > [];
245249
246250 final unreadCount = store.unreads.countInChannelNarrow (channelId);
247251 if (unreadCount > 0 ) {
248- optionButtons .add (
252+ buttons .add (
249253 MarkChannelAsReadButton (pageContext: pageContext, channelId: channelId));
250254 }
251255
252- optionButtons .add (
256+ buttons .add (
253257 TopicListButton (pageContext: pageContext, channelId: channelId));
254258
255- optionButtons .add (
259+ buttons .add (
256260 CopyChannelLinkButton (channelId: channelId, pageContext: pageContext));
257261
258- _showActionSheet (pageContext, optionButtons : optionButtons );
262+ _showContextMenu (pageContext, buttons : buttons );
259263}
260264
261- class MarkChannelAsReadButton extends ActionSheetMenuItemButton {
265+ class MarkChannelAsReadButton extends ContextMenuItemButton {
262266 const MarkChannelAsReadButton ({
263267 super .key,
264268 required this .channelId,
@@ -282,7 +286,7 @@ class MarkChannelAsReadButton extends ActionSheetMenuItemButton {
282286 }
283287}
284288
285- class TopicListButton extends ActionSheetMenuItemButton {
289+ class TopicListButton extends ContextMenuItemButton {
286290 const TopicListButton ({
287291 super .key,
288292 required this .channelId,
@@ -306,7 +310,7 @@ class TopicListButton extends ActionSheetMenuItemButton {
306310 }
307311}
308312
309- class CopyChannelLinkButton extends ActionSheetMenuItemButton {
313+ class CopyChannelLinkButton extends ContextMenuItemButton {
310314 const CopyChannelLinkButton ({
311315 super .key,
312316 required this .channelId,
@@ -350,7 +354,7 @@ void showTopicActionSheet(BuildContext context, {
350354 final store = PerAccountStoreWidget .of (pageContext);
351355 final subscription = store.subscriptions[channelId];
352356
353- final optionButtons = < ActionSheetMenuItemButton > [];
357+ final buttons = < ContextMenuItemButton > [];
354358
355359 // TODO(server-7): simplify this condition away
356360 final supportsUnmutingTopics = store.zulipFeatureLevel >= 170 ;
@@ -412,7 +416,7 @@ void showTopicActionSheet(BuildContext context, {
412416 }
413417 }
414418 }
415- optionButtons .addAll (visibilityOptions.map ((to) {
419+ buttons .addAll (visibilityOptions.map ((to) {
416420 return UserTopicUpdateButton (
417421 currentVisibilityPolicy: visibilityPolicy,
418422 newVisibilityPolicy: to,
@@ -423,27 +427,27 @@ void showTopicActionSheet(BuildContext context, {
423427 // TODO: check for other cases that may disallow this action (e.g.: time
424428 // limit for editing topics).
425429 if (someMessageIdInTopic != null && topic.displayName != null ) {
426- optionButtons .add (ResolveUnresolveButton (pageContext: pageContext,
430+ buttons .add (ResolveUnresolveButton (pageContext: pageContext,
427431 topic: topic,
428432 someMessageIdInTopic: someMessageIdInTopic));
429433 }
430434
431435 final unreadCount = store.unreads.countInTopicNarrow (channelId, topic);
432436 if (unreadCount > 0 ) {
433- optionButtons .add (MarkTopicAsReadButton (
437+ buttons .add (MarkTopicAsReadButton (
434438 channelId: channelId,
435439 topic: topic,
436440 pageContext: context));
437441 }
438442
439- optionButtons .add (CopyTopicLinkButton (
443+ buttons .add (CopyTopicLinkButton (
440444 narrow: TopicNarrow (channelId, topic, with_: someMessageIdInTopic),
441445 pageContext: context));
442446
443- _showActionSheet (pageContext, optionButtons : optionButtons );
447+ _showContextMenu (pageContext, buttons : buttons );
444448}
445449
446- class UserTopicUpdateButton extends ActionSheetMenuItemButton {
450+ class UserTopicUpdateButton extends ContextMenuItemButton {
447451 const UserTopicUpdateButton ({
448452 super .key,
449453 required this .currentVisibilityPolicy,
@@ -562,7 +566,7 @@ class UserTopicUpdateButton extends ActionSheetMenuItemButton {
562566 }
563567}
564568
565- class ResolveUnresolveButton extends ActionSheetMenuItemButton {
569+ class ResolveUnresolveButton extends ContextMenuItemButton {
566570 ResolveUnresolveButton ({
567571 super .key,
568572 required this .topic,
@@ -573,14 +577,14 @@ class ResolveUnresolveButton extends ActionSheetMenuItemButton {
573577 /// The topic that the action sheet was opened for.
574578 ///
575579 /// There might not currently be any messages with this topic;
576- /// see dartdoc of [ActionSheetMenuItemButton ] .
580+ /// see dartdoc of [ContextMenuItemButton ] .
577581 final TopicName topic;
578582
579583 /// The message ID that was passed when opening the action sheet.
580584 ///
581585 /// The message with this ID might currently not exist,
582586 /// or might exist with a different topic;
583- /// see dartdoc of [ActionSheetMenuItemButton ] .
587+ /// see dartdoc of [ContextMenuItemButton ] .
584588 final int someMessageIdInTopic;
585589
586590 final bool _actionIsResolve;
@@ -636,7 +640,7 @@ class ResolveUnresolveButton extends ActionSheetMenuItemButton {
636640 }
637641}
638642
639- class MarkTopicAsReadButton extends ActionSheetMenuItemButton {
643+ class MarkTopicAsReadButton extends ContextMenuItemButton {
640644 const MarkTopicAsReadButton ({
641645 super .key,
642646 required this .channelId,
@@ -659,7 +663,7 @@ class MarkTopicAsReadButton extends ActionSheetMenuItemButton {
659663 }
660664}
661665
662- class CopyTopicLinkButton extends ActionSheetMenuItemButton {
666+ class CopyTopicLinkButton extends ContextMenuItemButton {
663667 const CopyTopicLinkButton ({
664668 super .key,
665669 required this .narrow,
@@ -711,7 +715,7 @@ void showMessageActionSheet({required BuildContext context, required Message mes
711715
712716 final isSenderMuted = store.isUserMuted (message.senderId);
713717
714- final optionButtons = [
718+ final buttons = [
715719 if (popularEmojiLoaded)
716720 ReactionButtons (message: message, pageContext: pageContext),
717721 if (hasReactions)
@@ -731,8 +735,8 @@ void showMessageActionSheet({required BuildContext context, required Message mes
731735 EditButton (message: message, pageContext: pageContext),
732736 ];
733737
734- _showActionSheet (pageContext,
735- optionButtons : optionButtons ,
738+ _showContextMenu (pageContext,
739+ buttons : buttons ,
736740 header: _MessageActionSheetHeader (message: message));
737741}
738742
@@ -769,7 +773,7 @@ class _MessageActionSheetHeader extends StatelessWidget {
769773 }
770774}
771775
772- abstract class MessageActionSheetMenuItemButton extends ActionSheetMenuItemButton {
776+ abstract class MessageActionSheetMenuItemButton extends ContextMenuItemButton {
773777 MessageActionSheetMenuItemButton ({
774778 super .key,
775779 required this .message,
0 commit comments