ClipRRect
TheClipRRect
widget in Stac allows you to clip its child using rounded rectangles. This is useful when you want to create UI elements with rounded corners.
Usage
Properties
Property | Type | Default | Description |
---|---|---|---|
borderRadius | StacBorderRadius | StacBorderRadius() (0 for all corners) | The border radius of the rounded corners. Can be specified as a single value, a list of 4 values, or an object with individual corner values. |
clipBehavior | Clip | antiAlias | The clipping behavior when content extends beyond the rounded rectangle. |
child | Widget | Required | The widget to clip with rounded corners. |
BorderRadius Format Options
TheborderRadius
property can be specified in multiple formats:
Single Value (applies to all corners)
List Format (topLeft, topRight, bottomLeft, bottomRight)
Object Format (specify each corner individually)
Clip Behavior Options
TheclipBehavior
property accepts the following values:
"antiAlias"
(default): Clip using anti-aliasing for smoother edges"hardEdge"
: Clip without anti-aliasing for sharper edges"antiAliasWithSaveLayer"
: Anti-aliased clipping with an offscreen buffer (higher quality but slower)"none"
: No clipping (not recommended for ClipRRect)