dottedLine static method
Implementation
static Widget dottedLine({
double height = .5,
required Color color,
EdgeInsets? margin,
}) {
return Container(
margin: margin,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
final boxWidth = constraints.constrainWidth();
double dashWidth = 10.0.h;
final dashHeight = height;
final dashCount = (boxWidth / (2 * dashWidth)).floor();
return Flex(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
direction: Axis.horizontal,
children: List.generate(
dashCount,
(_) {
return SizedBox(
width: dashWidth,
height: dashHeight,
child: DecoratedBox(
decoration: BoxDecoration(color: color),
),
);
},
),
);
},
),
);
}