separated static method
Add a StreamContextMenuSeparator between each action in the given
items.
If items is empty or contains a single element, no separators are
added. The result can be passed directly to StreamContextMenu.new's
children parameter.
{@tool snippet}
StreamContextMenu(
children: StreamContextMenuAction.separated(
items: [
StreamContextMenuAction(label: Text('Reply')),
StreamContextMenuAction(label: Text('Copy')),
StreamContextMenuAction(label: Text('Delete')),
],
),
)
{@end-tool}
See also:
- StreamContextMenuSeparator, which you can use to obtain this effect manually.
Implementation
static List<Widget> separated({
required List<Widget> items,
}) {
return [
for (final (index, child) in items.indexed) ...[
if (index > 0) const StreamContextMenuSeparator(),
child,
],
];
}