renderChildrenWithGap method

List<Widget> renderChildrenWithGap(
  1. List<Widget> children
)

Implementation

List<Widget> renderChildrenWithGap(List<Widget> children) {
  // If no gap is set return widgets
  if (attr.gap == null) return children;

  // List of widgets with gap
  final widgets = <Widget>[];
  for (var idx = 0; idx < children.length; idx++) {
    final widget = children[idx];
    widgets.add(widget);
    // Add gap if not last item if its not last element

    if (widget != children.last) {
      widgets.add(GapWidget(attr.gap!.value));
    }
  }

  return widgets;
}