withDivider method
Add a divider between each child.
width
is the width of the divider.
color
is the color of the divider.
thickness
is the thickness of the divider.
indent
is the indent of the divider.
endIndent
is the endIndent of the divider.
Example:
Row(
children: [
Text("Hello"),
Text("World"),
]).withDivider(),
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,
),
);
}