SliverClipRRect constructor
- Key? key,
- required Widget sliver,
- BorderRadiusGeometry borderRadius = .zero,
- CustomClipper<
RRect> ? clipper, - Clip clipBehavior = .antiAlias,
- ClipOverlapBehavior clipOverlap = .followEdge,
Creates a sliver that clips its child using a rounded rectangle.
The borderRadius defaults to BorderRadius.zero, i.e. a rectangle with
right-angled corners.
If clipper is non-null, then borderRadius is ignored.
If clipBehavior is Clip.none, no clipping will be applied.
The clipOverlap parameter controls how the clip reacts to the area that overlaps with a preceding pinned sliver:
- ClipOverlapBehavior.followEdge (default): the clip rectangle is truncated at the overlap boundary.
- ClipOverlapBehavior.preserveShape: the entire rounded rectangle shifts inward so that corners are never hidden by the overlap. This produces a smoother visual when items scroll underneath a pinned header.
- ClipOverlapBehavior.none: the overlap is ignored and no additional clipping is applied.
Implementation
const SliverClipRRect({
super.key,
required Widget sliver,
this.borderRadius = .zero,
this.clipper,
this.clipBehavior = .antiAlias,
this.clipOverlap = .followEdge,
}) : super(child: sliver);