squircle function

SmoothRectangleBorder squircle({
  1. BorderSide side = BorderSide.none,
  2. double radius = 10,
  3. bool topLeft = true,
  4. bool topRight = true,
  5. bool bottomLeft = true,
  6. bool bottomRight = true,
  7. bool left = true,
  8. bool right = true,
  9. bool top = true,
  10. bool bottom = true,
  11. BorderAlign borderAlign = BorderAlign.inside,
})

Creates a squircle border with the given radius.

Implementation

SmoothRectangleBorder squircle({
  BorderSide side = BorderSide.none,
  double radius = 10,
  bool topLeft = true,
  bool topRight = true,
  bool bottomLeft = true,
  bool bottomRight = true,
  bool left = true,
  bool right = true,
  bool top = true,
  bool bottom = true,
  BorderAlign borderAlign = BorderAlign.inside,
}) {
  final _radius = SmoothRadius(
    cornerRadius: radius,
    cornerSmoothing: 0.9,
  );

  return SmoothRectangleBorder(
    side: side,
    borderAlign: borderAlign,
    borderRadius: SmoothBorderRadius.only(
      topLeft: topLeft ? _radius : SmoothRadius.zero,
      topRight: topRight ? _radius : SmoothRadius.zero,
      bottomLeft: bottomLeft ? _radius : SmoothRadius.zero,
      bottomRight: bottomRight ? _radius : SmoothRadius.zero,
    ),
  );
}