@@ -23,6 +23,7 @@ class TableBorder {
2323 this .left = BorderSide .none,
2424 this .horizontalInside = BorderSide .none,
2525 this .verticalInside = BorderSide .none,
26+ this .borderRadius = BorderRadius .zero,
2627 });
2728
2829 /// A uniform border with all sides the same color and width.
@@ -32,9 +33,10 @@ class TableBorder {
3233 Color color = const Color (0xFF000000 ),
3334 double width = 1.0 ,
3435 BorderStyle style = BorderStyle .solid,
36+ BorderRadius borderRadius = BorderRadius .zero,
3537 }) {
3638 final BorderSide side = BorderSide (color: color, width: width, style: style);
37- return TableBorder (top: side, right: side, bottom: side, left: side, horizontalInside: side, verticalInside: side);
39+ return TableBorder (top: side, right: side, bottom: side, left: side, horizontalInside: side, verticalInside: side, borderRadius : borderRadius );
3840 }
3941
4042 /// Creates a border for a table where all the interior sides use the same
@@ -71,6 +73,9 @@ class TableBorder {
7173 /// The vertical interior sides of this border.
7274 final BorderSide verticalInside;
7375
76+ /// The [BorderRadius] to use when painting the corners of this border.
77+ final BorderRadius borderRadius;
78+
7479 /// The widths of the sides of this border represented as an [EdgeInsets] .
7580 ///
7681 /// This can be used, for example, with a [Padding] widget to inset a box by
@@ -256,7 +261,14 @@ class TableBorder {
256261 }
257262 }
258263 }
259- paintBorder (canvas, rect, top: top, right: right, bottom: bottom, left: left);
264+ if (! isUniform || borderRadius == BorderRadius .zero)
265+ paintBorder (canvas, rect, top: top, right: right, bottom: bottom, left: left);
266+ else {
267+ final RRect outer = borderRadius.toRRect (rect);
268+ final RRect inner = outer.deflate (top.width);
269+ final Paint paint = Paint ()..color = top.color;
270+ canvas.drawDRRect (outer, inner, paint);
271+ }
260272 }
261273
262274 @override
@@ -271,12 +283,13 @@ class TableBorder {
271283 && other.bottom == bottom
272284 && other.left == left
273285 && other.horizontalInside == horizontalInside
274- && other.verticalInside == verticalInside;
286+ && other.verticalInside == verticalInside
287+ && other.borderRadius == borderRadius;
275288 }
276289
277290 @override
278- int get hashCode => hashValues (top, right, bottom, left, horizontalInside, verticalInside);
291+ int get hashCode => hashValues (top, right, bottom, left, horizontalInside, verticalInside, borderRadius );
279292
280293 @override
281- String toString () => 'TableBorder($top , $right , $bottom , $left , $horizontalInside , $verticalInside )' ;
294+ String toString () => 'TableBorder($top , $right , $bottom , $left , $horizontalInside , $verticalInside , $ borderRadius )' ;
282295}
0 commit comments