838
Committed by David PHAM-VAN

Add options to customise border in Dataset widget

@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 - Fix unit tests 8 - Fix unit tests
9 - Update Image dependency 9 - Update Image dependency
10 - Fix lints 10 - Fix lints
  11 +- Add options to customise border in Dataset widget [838]
11 12
12 ## 3.8.4 13 ## 3.8.4
13 14
@@ -27,8 +27,8 @@ class BarDataSet<T extends PointChartValue> extends PointDataSet<T> { @@ -27,8 +27,8 @@ class BarDataSet<T extends PointChartValue> extends PointDataSet<T> {
27 BarDataSet({ 27 BarDataSet({
28 required List<T> data, 28 required List<T> data,
29 String? legend, 29 String? legend,
30 - this.borderColor,  
31 - this.borderWidth = 1.5, 30 + PdfColor? borderColor,
  31 + double borderWidth = 1.5,
32 PdfColor color = PdfColors.blue, 32 PdfColor color = PdfColors.blue,
33 bool? drawBorder, 33 bool? drawBorder,
34 this.drawSurface = true, 34 this.drawSurface = true,
@@ -54,11 +54,11 @@ class BarDataSet<T extends PointChartValue> extends PointDataSet<T> { @@ -54,11 +54,11 @@ class BarDataSet<T extends PointChartValue> extends PointDataSet<T> {
54 pointSize: pointSize, 54 pointSize: pointSize,
55 shape: shape, 55 shape: shape,
56 valuePosition: valuePosition, 56 valuePosition: valuePosition,
  57 + borderColor: borderColor,
  58 + borderWidth: borderWidth,
57 ); 59 );
58 60
59 final bool drawBorder; 61 final bool drawBorder;
60 - final PdfColor? borderColor;  
61 - final double borderWidth;  
62 62
63 final bool drawSurface; 63 final bool drawSurface;
64 64
@@ -152,12 +152,18 @@ abstract class Dataset extends Widget { @@ -152,12 +152,18 @@ abstract class Dataset extends Widget {
152 Dataset({ 152 Dataset({
153 this.legend, 153 this.legend,
154 this.color, 154 this.color,
  155 + this.borderColor,
  156 + this.borderWidth = .5,
155 }); 157 });
156 158
157 final String? legend; 159 final String? legend;
158 160
159 final PdfColor? color; 161 final PdfColor? color;
160 162
  163 + final PdfColor? borderColor;
  164 +
  165 + final double borderWidth;
  166 +
161 void paintBackground(Context context) {} 167 void paintBackground(Context context) {}
162 168
163 void paintForeground(Context context) {} 169 void paintForeground(Context context) {}
@@ -167,8 +173,8 @@ abstract class Dataset extends Widget { @@ -167,8 +173,8 @@ abstract class Dataset extends Widget {
167 decoration: BoxDecoration( 173 decoration: BoxDecoration(
168 color: color, 174 color: color,
169 border: Border.all( 175 border: Border.all(
170 - color: PdfColors.black,  
171 - width: .5, 176 + color: borderColor ?? PdfColors.black,
  177 + width: borderWidth,
172 ), 178 ),
173 ), 179 ),
174 ); 180 );
@@ -118,8 +118,8 @@ class PieDataSet extends Dataset { @@ -118,8 +118,8 @@ class PieDataSet extends Dataset {
118 required this.value, 118 required this.value,
119 String? legend, 119 String? legend,
120 required PdfColor color, 120 required PdfColor color,
121 - this.borderColor = PdfColors.white,  
122 - this.borderWidth = 1.5, 121 + PdfColor? borderColor = PdfColors.white,
  122 + double borderWidth = 1.5,
123 bool? drawBorder, 123 bool? drawBorder,
124 this.drawSurface = true, 124 this.drawSurface = true,
125 this.surfaceOpacity = 1, 125 this.surfaceOpacity = 1,
@@ -142,6 +142,8 @@ class PieDataSet extends Dataset { @@ -142,6 +142,8 @@ class PieDataSet extends Dataset {
142 super( 142 super(
143 legend: legend, 143 legend: legend,
144 color: color, 144 color: color,
  145 + borderColor: borderColor,
  146 + borderWidth: borderWidth,
145 ); 147 );
146 148
147 final num value; 149 final num value;
@@ -151,8 +153,6 @@ class PieDataSet extends Dataset { @@ -151,8 +153,6 @@ class PieDataSet extends Dataset {
151 late double angleEnd; 153 late double angleEnd;
152 154
153 final bool drawBorder; 155 final bool drawBorder;
154 - final PdfColor? borderColor;  
155 - final double borderWidth;  
156 156
157 final bool drawSurface; 157 final bool drawSurface;
158 158
@@ -37,6 +37,8 @@ class PointDataSet<T extends PointChartValue> extends Dataset { @@ -37,6 +37,8 @@ class PointDataSet<T extends PointChartValue> extends Dataset {
37 String? legend, 37 String? legend,
38 this.pointSize = 3, 38 this.pointSize = 3,
39 PdfColor color = PdfColors.blue, 39 PdfColor color = PdfColors.blue,
  40 + PdfColor? borderColor,
  41 + double borderWidth = 1.5,
40 this.drawPoints = true, 42 this.drawPoints = true,
41 this.shape, 43 this.shape,
42 this.buildValue, 44 this.buildValue,
@@ -44,6 +46,8 @@ class PointDataSet<T extends PointChartValue> extends Dataset { @@ -44,6 +46,8 @@ class PointDataSet<T extends PointChartValue> extends Dataset {
44 }) : super( 46 }) : super(
45 legend: legend, 47 legend: legend,
46 color: color, 48 color: color,
  49 + borderColor: borderColor,
  50 + borderWidth: borderWidth,
47 ); 51 );
48 52
49 final List<T> data; 53 final List<T> data;