Showing
2 changed files
with
54 additions
and
0 deletions
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | - Add dashed lines to Decoration Widgets | 7 | - Add dashed lines to Decoration Widgets |
8 | - Add TableRow decoration | 8 | - Add TableRow decoration |
9 | - Add Chart Widget [Marco Papula] | 9 | - Add Chart Widget [Marco Papula] |
10 | +- Add Divider Widget | ||
10 | 11 | ||
11 | ## 1.6.2 | 12 | ## 1.6.2 |
12 | 13 |
@@ -766,3 +766,56 @@ class Opacity extends SingleChildWidget { | @@ -766,3 +766,56 @@ class Opacity extends SingleChildWidget { | ||
766 | } | 766 | } |
767 | } | 767 | } |
768 | } | 768 | } |
769 | + | ||
770 | +class Divider extends StatelessWidget { | ||
771 | + Divider({ | ||
772 | + this.height, | ||
773 | + this.thickness, | ||
774 | + this.indent, | ||
775 | + this.endIndent, | ||
776 | + this.color, | ||
777 | + }) : assert(height == null || height >= 0.0), | ||
778 | + assert(thickness == null || thickness >= 0.0), | ||
779 | + assert(indent == null || indent >= 0.0), | ||
780 | + assert(endIndent == null || endIndent >= 0.0); | ||
781 | + | ||
782 | + /// The color to use when painting the line. | ||
783 | + final PdfColor color; | ||
784 | + | ||
785 | + /// The amount of empty space to the trailing edge of the divider. | ||
786 | + final double endIndent; | ||
787 | + | ||
788 | + /// The divider's height extent. | ||
789 | + final double height; | ||
790 | + | ||
791 | + /// The amount of empty space to the leading edge of the divider. | ||
792 | + final double indent; | ||
793 | + | ||
794 | + /// The thickness of the line drawn within the divider. | ||
795 | + final double thickness; | ||
796 | + | ||
797 | + @override | ||
798 | + Widget build(Context context) { | ||
799 | + final double height = this.height ?? 16; | ||
800 | + final double thickness = this.thickness ?? 1; | ||
801 | + final double indent = this.indent ?? 0; | ||
802 | + final double endIndent = this.endIndent ?? 0; | ||
803 | + | ||
804 | + return SizedBox( | ||
805 | + height: height, | ||
806 | + child: Center( | ||
807 | + child: Container( | ||
808 | + height: thickness, | ||
809 | + margin: EdgeInsets.only(left: indent, right: endIndent), | ||
810 | + decoration: BoxDecoration( | ||
811 | + border: BoxBorder( | ||
812 | + bottom: true, | ||
813 | + color: color, | ||
814 | + width: thickness, | ||
815 | + ), | ||
816 | + ), | ||
817 | + ), | ||
818 | + ), | ||
819 | + ); | ||
820 | + } | ||
821 | +} |
-
Please register or login to post a comment