As of now, there is no default dotted borderline support in flutter. If there is one, it would have been easy to draw a dotted line using that functionality.
Dotted line reference below,
So, here I'm sharing the class for drawing a horizontal dotted line.
class DrawDottedhorizontalline extends CustomPainter {
Paint _paint;
DrawDottedhorizontalline() {
_paint = Paint()
..color = Colors.black
..strokeWidth = 2
..strokeCap = StrokeCap.round;
}
@override
void paint(Canvas canvas, Size size) {
for(double i = -300; i < 300; i = i + 15){
if(i% 3 == 0)
canvas.drawLine(Offset(i, 0.0), Offset(i+10, 0.0), _paint);
}
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return false;
}
}
Here is how you call it.
Container(
color: Colors.white,
height: 40.0,
child: Center(child:
CustomPaint(painter: DrawDottedhorizontalline()),
),),
),
Hope this helps.
Thanks,Srikanth