@@ -439,44 +439,63 @@ class OutlineInputBorder extends InputBorder {
439439 scaledRRect.left,
440440 scaledRRect.bottom - scaledRRect.blRadiusY * 2.0 ,
441441 scaledRRect.blRadiusX * 2.0 ,
442- scaledRRect.blRadiusX * 2.0 ,
442+ scaledRRect.blRadiusY * 2.0 ,
443443 );
444444
445445 // This assumes that the radius is circular (x and y radius are equal).
446446 // Currently, BorderRadius only supports circular radii.
447447 const double cornerArcSweep = math.pi / 2.0 ;
448- final double tlCornerArcSweep = math.acos (
449- clampDouble (1 - start / scaledRRect.tlRadiusX, 0.0 , 1.0 ),
450- );
448+ final Path path = Path ();
451449
452- final Path path = Path ()
453- ..addArc (tlCorner, math.pi, tlCornerArcSweep);
450+ // Top left corner
451+ if (scaledRRect.tlRadius != Radius .zero) {
452+ final double tlCornerArcSweep = math.acos (clampDouble (1 - start / scaledRRect.tlRadiusX, 0.0 , 1.0 ));
453+ path.addArc (tlCorner, math.pi, tlCornerArcSweep);
454+ } else {
455+ // Because the path is painted with Paint.strokeCap = StrokeCap.butt, horizontal coordinate is moved
456+ // to the left using borderSide.width / 2.
457+ path.moveTo (scaledRRect.left - borderSide.width / 2 , scaledRRect.top);
458+ }
454459
460+ // Draw top border from top left corner to gap start.
455461 if (start > scaledRRect.tlRadiusX) {
456462 path.lineTo (scaledRRect.left + start, scaledRRect.top);
457463 }
458464
465+ // Draw top border from gap end to top right corner and draw top right corner.
459466 const double trCornerArcStart = (3 * math.pi) / 2.0 ;
460467 const double trCornerArcSweep = cornerArcSweep;
461468 if (start + extent < scaledRRect.width - scaledRRect.trRadiusX) {
462469 path.moveTo (scaledRRect.left + start + extent, scaledRRect.top);
463470 path.lineTo (scaledRRect.right - scaledRRect.trRadiusX, scaledRRect.top);
464- path.addArc (trCorner, trCornerArcStart, trCornerArcSweep);
471+ if (scaledRRect.trRadius != Radius .zero) {
472+ path.addArc (trCorner, trCornerArcStart, trCornerArcSweep);
473+ }
465474 } else if (start + extent < scaledRRect.width) {
466475 final double dx = scaledRRect.width - (start + extent);
467- final double sweep = math.asin (
468- clampDouble (1 - dx / scaledRRect.trRadiusX, 0.0 , 1.0 ),
469- );
476+ final double sweep = math.asin (clampDouble (1 - dx / scaledRRect.trRadiusX, 0.0 , 1.0 ));
470477 path.addArc (trCorner, trCornerArcStart + sweep, trCornerArcSweep - sweep);
471478 }
472479
473- return path
474- ..moveTo (scaledRRect.right, scaledRRect.top + scaledRRect.trRadiusY)
475- ..lineTo (scaledRRect.right, scaledRRect.bottom - scaledRRect.brRadiusY)
476- ..addArc (brCorner, 0.0 , cornerArcSweep)
477- ..lineTo (scaledRRect.left + scaledRRect.blRadiusX, scaledRRect.bottom)
478- ..addArc (blCorner, math.pi / 2.0 , cornerArcSweep)
479- ..lineTo (scaledRRect.left, scaledRRect.top + scaledRRect.tlRadiusY);
480+ // Draw right border and bottom right corner.
481+ if (scaledRRect.brRadius != Radius .zero) {
482+ path.moveTo (scaledRRect.right, scaledRRect.top + scaledRRect.trRadiusY);
483+ }
484+ path.lineTo (scaledRRect.right, scaledRRect.bottom - scaledRRect.brRadiusY);
485+ if (scaledRRect.brRadius != Radius .zero) {
486+ path.addArc (brCorner, 0.0 , cornerArcSweep);
487+ }
488+
489+ // Draw bottom border and bottom left corner.
490+ path.lineTo (scaledRRect.left + scaledRRect.blRadiusX, scaledRRect.bottom);
491+ if (scaledRRect.blRadius != Radius .zero) {
492+ path.addArc (blCorner, math.pi / 2.0 , cornerArcSweep);
493+ }
494+
495+ // Draw left border
496+ path.lineTo (scaledRRect.left, scaledRRect.top + scaledRRect.tlRadiusY);
497+
498+ return path;
480499 }
481500
482501 /// Draw a rounded rectangle around [rect] using [borderRadius] .
0 commit comments