SliverClipRect constructor
- Key? key,
- required Widget sliver,
- CustomClipper<
Rect> ? clipper, - Clip clipBehavior = .hardEdge,
- ClipOverlapBehavior clipOverlap = .followEdge,
Creates a sliver that clips its child using a rectangle.
If clipper is null, the clip will match the layout size and position of
the child.
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: behaves exactly like ClipOverlapBehavior.followEdge here, because a plain rectangle has no rounded corners to preserve. Use SliverClipRRect to get the shifting behavior.
- ClipOverlapBehavior.none: the overlap is ignored and no additional clipping is applied.
Implementation
const SliverClipRect({
super.key,
required Widget sliver,
this.clipper,
this.clipBehavior = .hardEdge,
this.clipOverlap = .followEdge,
}) : super(child: sliver);