CouponClipper constructor

const CouponClipper({
  1. double borderRadius = 8,
  2. double curveRadius = 20,
  3. double curvePosition = 100,
  4. Axis curveAxis = Axis.horizontal,
  5. TextDirection direction = TextDirection.ltr,
  6. bool clockwise = false,
})

Paints a coupon shape around any widget.

Usage:

ClipPath(
  clipper: CouponClipper(
    // optional (defaults to TextDirection.ltr), works when
    // curveAxis set to Axis.vertical
    direction: Directionality.of(context),
  ),
  // width and height are important depending on the type
  // of the text direction
  child: Container(
    width: 350,
    height: 400,
    color: Colors.purple,
  ),
),

Implementation

const CouponClipper({
  this.borderRadius = 8,
  this.curveRadius = 20,
  this.curvePosition = 100,
  this.curveAxis = Axis.horizontal,
  this.direction = TextDirection.ltr,
  this.clockwise = false,
}) : assert(
        curvePosition > borderRadius,
        "'curvePosition' should be greater than the 'borderRadius'",
      );