Skip to content

Commit 9d6a8c2

Browse files
committed
action_sheet [nfc]: Refactor showChannelActionSheet button sections
1 parent 540e019 commit 9d6a8c2

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
@@ -249,21 +249,17 @@ void showChannelActionSheet(BuildContext context, {
249249
final pageContext = PageRoot.contextOf(context);
250250
final store = PerAccountStoreWidget.of(pageContext);
251251

252-
final buttons = <ContextMenuItemButton>[];
253-
254252
final unreadCount = store.unreads.countInChannelNarrow(channelId);
255-
if (unreadCount > 0) {
256-
buttons.add(
257-
MarkChannelAsReadButton(pageContext: pageContext, channelId: channelId));
258-
}
259-
260-
buttons.add(
261-
TopicListButton(pageContext: pageContext, channelId: channelId));
262-
263-
buttons.add(
264-
CopyChannelLinkButton(channelId: channelId, pageContext: pageContext));
253+
final buttonSections = [
254+
[
255+
if (unreadCount > 0)
256+
MarkChannelAsReadButton(pageContext: pageContext, channelId: channelId),
257+
TopicListButton(pageContext: pageContext, channelId: channelId),
258+
CopyChannelLinkButton(channelId: channelId, pageContext: pageContext)
259+
]
260+
];
265261

266-
_showContextMenu(pageContext, buttonSections: [buttons]);
262+
_showContextMenu(pageContext, buttonSections: buttonSections);
267263
}
268264

269265
class MarkChannelAsReadButton extends ContextMenuItemButton {

0 commit comments

Comments
 (0)