@@ -34,10 +34,14 @@ import 'text.dart';
34
34
import 'theme.dart' ;
35
35
import 'topic_list.dart' ;
36
36
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 (
38
42
BuildContext pageContext, {
39
43
Widget ? header,
40
- required List <Widget > optionButtons ,
44
+ required List <Widget > buttons ,
41
45
}) {
42
46
// Could omit this if we need _showActionSheet outside a per-account context.
43
47
final accountId = PerAccountStoreWidget .accountIdOf (pageContext);
@@ -91,21 +95,21 @@ void _showActionSheet(
91
95
color: designVariables.bgContextMenu,
92
96
child: SingleChildScrollView (
93
97
padding: const EdgeInsets .symmetric (vertical: 8 ),
94
- child: MenuButtonsShape (buttons: optionButtons )))),
98
+ child: MenuButtonsShape (buttons: buttons )))),
95
99
const BottomSheetDismissButton (style: BottomSheetDismissButtonStyle .cancel),
96
100
]))),
97
101
]))));
98
102
});
99
103
}
100
104
101
- /// A header for a bottom sheet with a multiline UI string.
105
+ /// A header for a context menu with a multiline UI string.
102
106
///
103
107
/// Assumes 8px padding below the top of the bottom sheet.
104
108
///
105
109
/// Figma:
106
110
/// 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});
109
113
110
114
final String text;
111
115
@@ -126,7 +130,7 @@ class BottomSheetHeaderPlainText extends StatelessWidget {
126
130
}
127
131
}
128
132
129
- /// A button in an action sheet .
133
+ /// A button in a context menu .
130
134
///
131
135
/// When built from server data, the action sheet ignores changes in that data;
132
136
/// we intentionally don't live-update the buttons on events.
@@ -140,8 +144,8 @@ class BottomSheetHeaderPlainText extends StatelessWidget {
140
144
/// (Even if we did live-update the buttons, it's possible anyway that a user's
141
145
/// action can race with a change that's already been applied on the server,
142
146
/// 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});
145
149
146
150
IconData get icon;
147
151
String label (ZulipLocalizations zulipLocalizations);
@@ -241,24 +245,24 @@ void showChannelActionSheet(BuildContext context, {
241
245
final pageContext = PageRoot .contextOf (context);
242
246
final store = PerAccountStoreWidget .of (pageContext);
243
247
244
- final optionButtons = < ActionSheetMenuItemButton > [];
248
+ final buttons = < ContextMenuItemButton > [];
245
249
246
250
final unreadCount = store.unreads.countInChannelNarrow (channelId);
247
251
if (unreadCount > 0 ) {
248
- optionButtons .add (
252
+ buttons .add (
249
253
MarkChannelAsReadButton (pageContext: pageContext, channelId: channelId));
250
254
}
251
255
252
- optionButtons .add (
256
+ buttons .add (
253
257
TopicListButton (pageContext: pageContext, channelId: channelId));
254
258
255
- optionButtons .add (
259
+ buttons .add (
256
260
CopyChannelLinkButton (channelId: channelId, pageContext: pageContext));
257
261
258
- _showActionSheet (pageContext, optionButtons : optionButtons );
262
+ _showContextMenu (pageContext, buttons : buttons );
259
263
}
260
264
261
- class MarkChannelAsReadButton extends ActionSheetMenuItemButton {
265
+ class MarkChannelAsReadButton extends ContextMenuItemButton {
262
266
const MarkChannelAsReadButton ({
263
267
super .key,
264
268
required this .channelId,
@@ -282,7 +286,7 @@ class MarkChannelAsReadButton extends ActionSheetMenuItemButton {
282
286
}
283
287
}
284
288
285
- class TopicListButton extends ActionSheetMenuItemButton {
289
+ class TopicListButton extends ContextMenuItemButton {
286
290
const TopicListButton ({
287
291
super .key,
288
292
required this .channelId,
@@ -306,7 +310,7 @@ class TopicListButton extends ActionSheetMenuItemButton {
306
310
}
307
311
}
308
312
309
- class CopyChannelLinkButton extends ActionSheetMenuItemButton {
313
+ class CopyChannelLinkButton extends ContextMenuItemButton {
310
314
const CopyChannelLinkButton ({
311
315
super .key,
312
316
required this .channelId,
@@ -350,7 +354,7 @@ void showTopicActionSheet(BuildContext context, {
350
354
final store = PerAccountStoreWidget .of (pageContext);
351
355
final subscription = store.subscriptions[channelId];
352
356
353
- final optionButtons = < ActionSheetMenuItemButton > [];
357
+ final buttons = < ContextMenuItemButton > [];
354
358
355
359
// TODO(server-7): simplify this condition away
356
360
final supportsUnmutingTopics = store.zulipFeatureLevel >= 170 ;
@@ -412,7 +416,7 @@ void showTopicActionSheet(BuildContext context, {
412
416
}
413
417
}
414
418
}
415
- optionButtons .addAll (visibilityOptions.map ((to) {
419
+ buttons .addAll (visibilityOptions.map ((to) {
416
420
return UserTopicUpdateButton (
417
421
currentVisibilityPolicy: visibilityPolicy,
418
422
newVisibilityPolicy: to,
@@ -423,27 +427,27 @@ void showTopicActionSheet(BuildContext context, {
423
427
// TODO: check for other cases that may disallow this action (e.g.: time
424
428
// limit for editing topics).
425
429
if (someMessageIdInTopic != null && topic.displayName != null ) {
426
- optionButtons .add (ResolveUnresolveButton (pageContext: pageContext,
430
+ buttons .add (ResolveUnresolveButton (pageContext: pageContext,
427
431
topic: topic,
428
432
someMessageIdInTopic: someMessageIdInTopic));
429
433
}
430
434
431
435
final unreadCount = store.unreads.countInTopicNarrow (channelId, topic);
432
436
if (unreadCount > 0 ) {
433
- optionButtons .add (MarkTopicAsReadButton (
437
+ buttons .add (MarkTopicAsReadButton (
434
438
channelId: channelId,
435
439
topic: topic,
436
440
pageContext: context));
437
441
}
438
442
439
- optionButtons .add (CopyTopicLinkButton (
443
+ buttons .add (CopyTopicLinkButton (
440
444
narrow: TopicNarrow (channelId, topic, with_: someMessageIdInTopic),
441
445
pageContext: context));
442
446
443
- _showActionSheet (pageContext, optionButtons : optionButtons );
447
+ _showContextMenu (pageContext, buttons : buttons );
444
448
}
445
449
446
- class UserTopicUpdateButton extends ActionSheetMenuItemButton {
450
+ class UserTopicUpdateButton extends ContextMenuItemButton {
447
451
const UserTopicUpdateButton ({
448
452
super .key,
449
453
required this .currentVisibilityPolicy,
@@ -562,7 +566,7 @@ class UserTopicUpdateButton extends ActionSheetMenuItemButton {
562
566
}
563
567
}
564
568
565
- class ResolveUnresolveButton extends ActionSheetMenuItemButton {
569
+ class ResolveUnresolveButton extends ContextMenuItemButton {
566
570
ResolveUnresolveButton ({
567
571
super .key,
568
572
required this .topic,
@@ -573,14 +577,14 @@ class ResolveUnresolveButton extends ActionSheetMenuItemButton {
573
577
/// The topic that the action sheet was opened for.
574
578
///
575
579
/// There might not currently be any messages with this topic;
576
- /// see dartdoc of [ActionSheetMenuItemButton ] .
580
+ /// see dartdoc of [ContextMenuItemButton ] .
577
581
final TopicName topic;
578
582
579
583
/// The message ID that was passed when opening the action sheet.
580
584
///
581
585
/// The message with this ID might currently not exist,
582
586
/// or might exist with a different topic;
583
- /// see dartdoc of [ActionSheetMenuItemButton ] .
587
+ /// see dartdoc of [ContextMenuItemButton ] .
584
588
final int someMessageIdInTopic;
585
589
586
590
final bool _actionIsResolve;
@@ -636,7 +640,7 @@ class ResolveUnresolveButton extends ActionSheetMenuItemButton {
636
640
}
637
641
}
638
642
639
- class MarkTopicAsReadButton extends ActionSheetMenuItemButton {
643
+ class MarkTopicAsReadButton extends ContextMenuItemButton {
640
644
const MarkTopicAsReadButton ({
641
645
super .key,
642
646
required this .channelId,
@@ -659,7 +663,7 @@ class MarkTopicAsReadButton extends ActionSheetMenuItemButton {
659
663
}
660
664
}
661
665
662
- class CopyTopicLinkButton extends ActionSheetMenuItemButton {
666
+ class CopyTopicLinkButton extends ContextMenuItemButton {
663
667
const CopyTopicLinkButton ({
664
668
super .key,
665
669
required this .narrow,
@@ -711,7 +715,7 @@ void showMessageActionSheet({required BuildContext context, required Message mes
711
715
712
716
final isSenderMuted = store.isUserMuted (message.senderId);
713
717
714
- final optionButtons = [
718
+ final buttons = [
715
719
if (popularEmojiLoaded)
716
720
ReactionButtons (message: message, pageContext: pageContext),
717
721
if (hasReactions)
@@ -731,8 +735,8 @@ void showMessageActionSheet({required BuildContext context, required Message mes
731
735
EditButton (message: message, pageContext: pageContext),
732
736
];
733
737
734
- _showActionSheet (pageContext,
735
- optionButtons : optionButtons ,
738
+ _showContextMenu (pageContext,
739
+ buttons : buttons ,
736
740
header: _MessageActionSheetHeader (message: message));
737
741
}
738
742
@@ -769,7 +773,7 @@ class _MessageActionSheetHeader extends StatelessWidget {
769
773
}
770
774
}
771
775
772
- abstract class MessageActionSheetMenuItemButton extends ActionSheetMenuItemButton {
776
+ abstract class MessageActionSheetMenuItemButton extends ContextMenuItemButton {
773
777
MessageActionSheetMenuItemButton ({
774
778
super .key,
775
779
required this .message,
0 commit comments