Skip to content

Commit 3eb3569

Browse files
committed
action_sheet [nfc]: Refactor showChannelActionSheet button sections
1 parent 7ba803e commit 3eb3569

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

lib/widgets/action_sheet.dart

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -245,21 +245,17 @@ void showChannelActionSheet(BuildContext context, {
245245
final pageContext = PageRoot.contextOf(context);
246246
final store = PerAccountStoreWidget.of(pageContext);
247247

248-
final optionButtons = <ActionSheetMenuItemButton>[];
249-
250248
final unreadCount = store.unreads.countInChannelNarrow(channelId);
251-
if (unreadCount > 0) {
252-
optionButtons.add(
253-
MarkChannelAsReadButton(pageContext: pageContext, channelId: channelId));
254-
}
255-
256-
optionButtons.add(
257-
TopicListButton(pageContext: pageContext, channelId: channelId));
258-
259-
optionButtons.add(
260-
CopyChannelLinkButton(channelId: channelId, pageContext: pageContext));
249+
final buttonSections = [
250+
[
251+
if (unreadCount > 0)
252+
MarkChannelAsReadButton(pageContext: pageContext, channelId: channelId),
253+
TopicListButton(pageContext: pageContext, channelId: channelId),
254+
CopyChannelLinkButton(channelId: channelId, pageContext: pageContext)
255+
]
256+
];
261257

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

265261
class MarkChannelAsReadButton extends ActionSheetMenuItemButton {

0 commit comments

Comments
 (0)