withDivider method

IntrinsicHeight withDivider({
  1. double width = 1,
  2. Color? color,
  3. double thickness = 1,
  4. double indent = 0,
  5. double endIndent = 0,
})

Add a divider between each child.

Implementation

IntrinsicHeight withDivider({
  double width = 1,
  Color? color,
  double thickness = 1,
  double indent = 0,
  double endIndent = 0,
}) {
  List<Widget> newChildren = [];
  for (int i = 0; i < children.length; i++) {
    newChildren.add(children[i]);
    if (i < children.length - 1) {
      newChildren.add(
        VerticalDivider(
          width: width,
          color: color ?? Colors.grey.shade300,
          thickness: thickness,
          indent: indent,
          endIndent: endIndent,
        ),
      );
    }
  }

  return IntrinsicHeight(
    child: Row(
      key: key,
      mainAxisAlignment: mainAxisAlignment,
      mainAxisSize: mainAxisSize,
      crossAxisAlignment: crossAxisAlignment,
      textDirection: textDirection,
      verticalDirection: verticalDirection,
      textBaseline: textBaseline,
      children: newChildren,
    ),
  );
}