Skip to content

Commit 7ba803e

Browse files
committed
action_sheet [nfc]: Support multiple button sections in action sheet
Some action sheets in the Figma have multiple groups/sections of buttons, like in the channel action sheet, which has e.g. "Mark all messages as read" in one section, "Channel settings" in another, and "Unsubscribe" in its own one-item section: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6327-96694&m=dev
1 parent b774221 commit 7ba803e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/widgets/action_sheet.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import 'topic_list.dart';
3737
void _showActionSheet(
3838
BuildContext pageContext, {
3939
Widget? header,
40-
required List<Widget> optionButtons,
40+
required List<List<Widget>> buttonSections,
4141
}) {
4242
// Could omit this if we need _showActionSheet outside a per-account context.
4343
final accountId = PerAccountStoreWidget.accountIdOf(pageContext);
@@ -91,7 +91,11 @@ void _showActionSheet(
9191
color: designVariables.bgContextMenu,
9292
child: SingleChildScrollView(
9393
padding: const EdgeInsets.symmetric(vertical: 8),
94-
child: MenuButtonsShape(buttons: optionButtons)))),
94+
child: Column(
95+
mainAxisSize: MainAxisSize.min,
96+
spacing: 8,
97+
children: buttonSections.map((buttons) =>
98+
MenuButtonsShape(buttons: buttons)).toList())))),
9599
const BottomSheetDismissButton(style: BottomSheetDismissButtonStyle.cancel),
96100
]))),
97101
]))));
@@ -255,7 +259,7 @@ void showChannelActionSheet(BuildContext context, {
255259
optionButtons.add(
256260
CopyChannelLinkButton(channelId: channelId, pageContext: pageContext));
257261

258-
_showActionSheet(pageContext, optionButtons: optionButtons);
262+
_showActionSheet(pageContext, buttonSections: [optionButtons]);
259263
}
260264

261265
class MarkChannelAsReadButton extends ActionSheetMenuItemButton {
@@ -440,7 +444,7 @@ void showTopicActionSheet(BuildContext context, {
440444
narrow: TopicNarrow(channelId, topic, with_: someMessageIdInTopic),
441445
pageContext: context));
442446

443-
_showActionSheet(pageContext, optionButtons: optionButtons);
447+
_showActionSheet(pageContext, buttonSections: [optionButtons]);
444448
}
445449

446450
class UserTopicUpdateButton extends ActionSheetMenuItemButton {
@@ -732,7 +736,7 @@ void showMessageActionSheet({required BuildContext context, required Message mes
732736
];
733737

734738
_showActionSheet(pageContext,
735-
optionButtons: optionButtons,
739+
buttonSections: [optionButtons],
736740
header: _MessageActionSheetHeader(message: message));
737741
}
738742

0 commit comments

Comments
 (0)