clipWidget method

Widget clipWidget(
  1. Widget current, {
  2. CustomClipper? clipper,
})

裁剪组件

Implementation

Widget clipWidget(Widget current, {CustomClipper<dynamic>? clipper}) {
  if (isOval) {
    return ClipOval(
        clipBehavior: clipBehavior ?? Clip.antiAlias, child: current);
  } else if (clipper is CustomClipper<Rect> || isClipRect) {
    return ClipRect(
        clipper: clipper is CustomClipper<Rect> ? clipper : null,
        clipBehavior: clipBehavior ?? Clip.hardEdge,
        child: current);
  } else if (clipper is CustomClipper<Path>) {
    return ClipPath(
        clipper: clipper,
        clipBehavior: clipBehavior ?? Clip.antiAlias,
        child: current);
  } else if (clipper is CustomClipper<RRect> || isClipRRect) {
    return ClipRRect(
        borderRadius: borderRadius,
        clipper: clipper is CustomClipper<RRect> ? clipper : null,
        clipBehavior: clipBehavior ?? Clip.antiAlias,
        child: current);
  }
  return current;
}