David PHAM-VAN

Add VerticalDivider Widget

@@ -7,7 +7,7 @@ @@ -7,7 +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 +- Add Divider and VerticalDivider Widget
11 - Replace Theme with ThemeData 11 - Replace Theme with ThemeData
12 12
13 ## 1.6.2 13 ## 1.6.2
@@ -819,3 +819,56 @@ class Divider extends StatelessWidget { @@ -819,3 +819,56 @@ class Divider extends StatelessWidget {
819 ); 819 );
820 } 820 }
821 } 821 }
  822 +
  823 +class VerticalDivider extends StatelessWidget {
  824 + VerticalDivider({
  825 + this.width,
  826 + this.thickness,
  827 + this.indent,
  828 + this.endIndent,
  829 + this.color,
  830 + }) : assert(width == null || width >= 0.0),
  831 + assert(thickness == null || thickness >= 0.0),
  832 + assert(indent == null || indent >= 0.0),
  833 + assert(endIndent == null || endIndent >= 0.0);
  834 +
  835 + /// The color to use when painting the line.
  836 + final PdfColor color;
  837 +
  838 + /// The amount of empty space to the trailing edge of the divider.
  839 + final double endIndent;
  840 +
  841 + /// The divider's width extent.
  842 + final double width;
  843 +
  844 + /// The amount of empty space to the leading edge of the divider.
  845 + final double indent;
  846 +
  847 + /// The thickness of the line drawn within the divider.
  848 + final double thickness;
  849 +
  850 + @override
  851 + Widget build(Context context) {
  852 + final double width = this.width ?? 16;
  853 + final double thickness = this.thickness ?? 1;
  854 + final double indent = this.indent ?? 0;
  855 + final double endIndent = this.endIndent ?? 0;
  856 +
  857 + return SizedBox(
  858 + width: width,
  859 + child: Center(
  860 + child: Container(
  861 + width: thickness,
  862 + margin: EdgeInsets.only(top: indent, bottom: endIndent),
  863 + decoration: BoxDecoration(
  864 + border: BoxBorder(
  865 + left: true,
  866 + color: color,
  867 + width: thickness,
  868 + ),
  869 + ),
  870 + ),
  871 + ),
  872 + );
  873 + }
  874 +}