biBeveledRectangle static method

  1. @Deprecated(_DEPRECATED)
BeveledRectangleBorder biBeveledRectangle({
  1. bool flip = false,
  2. double radius = 5,
  3. bool shrinkOneCorner = false,
  4. double ratio = 5 / 4,
  5. AlignmentGeometry? shrinkCornerAlignment,
})

_DEPRECATED - 🔰 Shape.biBeveledRectangle

Returns a BeveledRectangleBorder where the passed 🔘 radius is applied to two diagonally opposite corners while the other two remain square.

Default is beveled topRight and bottomLeft, but flip passed true will mirror the result.

Pass true to shrinkOneCorner to increase the radius on one of the resultant beveled corners based on Alignment pass to shrinkCornerAlignment.

This aids when stacking multiple 🔰 Shape within one another when offset with padding while a uniform border is desired.

(See: [Surface._buildBiBeveledShape)

Implementation

@Deprecated(_DEPRECATED)
static BeveledRectangleBorder biBeveledRectangle({
  bool flip = false,
  double radius = 5,
  bool shrinkOneCorner = false,
  double ratio = 5 / 4,
  AlignmentGeometry? shrinkCornerAlignment,
}) {
  double tr = (flip) ? 0.0 : radius;
  double bl = (flip) ? 0.0 : radius;
  double tl = (flip) ? radius : 0.0;
  double br = (flip) ? radius : 0.0;

  if (shrinkOneCorner) {
    if ((shrinkCornerAlignment ?? Alignment.center) != Alignment.center) {
      if (shrinkCornerAlignment == Alignment.topRight)
        tr *= ratio;
      else if (shrinkCornerAlignment == Alignment.bottomRight)
        br *= ratio;
      else if (shrinkCornerAlignment == Alignment.bottomLeft)
        bl *= ratio;
      else if (shrinkCornerAlignment == Alignment.topLeft) tl *= ratio;
    }
  }

  return BeveledRectangleBorder(
    borderRadius: BorderRadius.only(
      topRight: Radius.circular(tr),
      bottomRight: Radius.circular(br),
      bottomLeft: Radius.circular(bl),
      topLeft: Radius.circular(tl),
    ),
  );
}