shape method Null safety

Widget shape(
  1. {Key? key,
  2. required ShapeBorder shape,
  3. Clip clipBehavior = Clip.antiAlias,
  4. Widget? child}
)

Creates a shape clip.

Uses a ShapeBorderClipper to configure the ClipPath to clip to the given ShapeBorder.

Implementation

static Widget shape({
  Key? key,
  required ShapeBorder shape,
  Clip clipBehavior = Clip.antiAlias,
  Widget? child,
}) {
  assert(clipBehavior != null);
  assert(shape != null);
  return Builder(
    key: key,
    builder: (BuildContext context) {
      return ClipPath(
        clipper: ShapeBorderClipper(
          shape: shape,
          textDirection: Directionality.maybeOf(context),
        ),
        clipBehavior: clipBehavior,
        child: child,
      );
    },
  );
}