withGap method

Column withGap(
  1. double space
)

Adds a gap between each child.

Implementation

Column withGap(double space) {
  assert(space >= 0, 'Space should be a non-negative value.');

  List<Widget> newChildren = [];
  for (int i = 0; i < children.length; i++) {
    newChildren.add(children[i]);
    if (i < children.length - 1) {
      newChildren.add(SizedBox(height: space));
    }
  }

  return Column(
    key: this.key,
    mainAxisAlignment: this.mainAxisAlignment,
    mainAxisSize: this.mainAxisSize,
    crossAxisAlignment: this.crossAxisAlignment,
    textDirection: this.textDirection,
    verticalDirection: this.verticalDirection,
    textBaseline: this.textBaseline,
    children: newChildren,
  );
}