Hello Guys,
In this article, I'm going to show you how to draw a horizontal line in Flutter. See below images on how the output is going to look. Nothing fancy.
; white-space: pre-wrap; background-color: rgb(233, 236, 239);]( font-size: 1rem; color: rgb(33, 37, 41); white-space: pre-wrap; background-color: rgb(233, 236, 239);](---------- or ----------- font-size: 1rem;](), then here is the link for that article. How to draw a Decorative Horizontal line in Flutter? - [https://fluttercentral.com/Articles/Post/1148font-size: 1rem;](https://fluttercentral.com/Articles/Post/1148)
; background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre;](color: #569cd6;](import color: #ce9178;]('package:flutter/material.dart';
color: #569cd6;](void main() { runApp(MyApp());}
color: #569cd6;](class MyApp color: #569cd6;](extends StatelessWidget { color: #569cd6;](@override Widget build(BuildContext context) { color: #569cd6;](return Center( child: Container( child: CustomPaint(painter: Drawhorizontalline()), ), ); }}
color: #569cd6;](class Drawhorizontalline color: #569cd6;](extends CustomPainter { Paint _paint;
Drawhorizontalline() { _paint = Paint() ..color = Colors.white ..strokeWidth = color: #b5cea8;](1 ..strokeCap = StrokeCap.round; }
color: #569cd6;](@override color: #569cd6;](void paint(Canvas canvas, Size size) { canvas.drawLine(Offset(-color: #b5cea8;](90.0, color: #b5cea8;](0.0), Offset(color: #b5cea8;](90.0, color: #b5cea8;](0.0), _paint); }
color: #569cd6;](@override color: #569cd6;](bool shouldRepaint(CustomPainter oldDelegate) { color: #569cd6;](return color: #569cd6;](false; }}
Actually, by changing a few things. You can draw vertical and cross lines too using this class.
Hope this is useful to you.
Thanks,Srikanth