getRoundedDown method

Path getRoundedDown(
  1. Size size
)

Implementation

Path getRoundedDown(Size size) {
  var topLeftPixelsFromTop = (size.height * topLeftPercentOfHeight) / 100.0;
  var topRightPixelsFromTop = (size.height * topRightPercentOfHeight) / 100.0;

  //100% is default and indicates a default rounding is desired since otherwise it creates a rectangle (which seems broken)
  var botLeftPct = bottomLeftPercentOfHeight == 100 ? 95 : bottomLeftPercentOfHeight;
  var botRightPct = bottomRightPercentOfHeight == 100 ? 95 : bottomRightPercentOfHeight;
  var bottomLeftPixelsFromTop = (size.height * botLeftPct) / 100.0;
  var bottomRightPixelsFromTop = (size.height * botRightPct) / 100.0;
  var delY = size.height - (bottomLeftPixelsFromTop + bottomRightPixelsFromTop) / 2.0;

  Path path = Path();
  path.moveTo(0.0, bottomLeftPixelsFromTop);
  path.quadraticBezierTo(
      size.width / 2, size.height + delY,
      size.width, bottomRightPixelsFromTop);
  path.lineTo(size.width, topRightPixelsFromTop);
  path.lineTo(0.0, topLeftPixelsFromTop);
  path.close();
  return path;
}