@@ -1429,13 +1429,13 @@ class RenderClipRect extends _RenderCustomClip<Rect> {
14291429 /// If [clipper] is null, the clip will match the layout size and position of
14301430 /// the child.
14311431 ///
1432- /// The [clipBehavior] must not be null or [Clip.none] .
1432+ /// The [clipBehavior] must not be null. If [clipBehavior] is
1433+ /// [Clip.none] , no clipping will be applied.
14331434 RenderClipRect ({
14341435 RenderBox ? child,
14351436 CustomClipper <Rect >? clipper,
14361437 Clip clipBehavior = Clip .antiAlias,
14371438 }) : assert (clipBehavior != null ),
1438- assert (clipBehavior != Clip .none),
14391439 super (child: child, clipper: clipper, clipBehavior: clipBehavior);
14401440
14411441 @override
@@ -1455,15 +1455,20 @@ class RenderClipRect extends _RenderCustomClip<Rect> {
14551455 @override
14561456 void paint (PaintingContext context, Offset offset) {
14571457 if (child != null ) {
1458- _updateClip ();
1459- layer = context.pushClipRect (
1460- needsCompositing,
1461- offset,
1462- _clip! ,
1463- super .paint,
1464- clipBehavior: clipBehavior,
1465- oldLayer: layer as ClipRectLayer ? ,
1466- );
1458+ if (clipBehavior != Clip .none) {
1459+ _updateClip ();
1460+ layer = context.pushClipRect (
1461+ needsCompositing,
1462+ offset,
1463+ _clip! ,
1464+ super .paint,
1465+ clipBehavior: clipBehavior,
1466+ oldLayer: layer as ClipRectLayer ? ,
1467+ );
1468+ } else {
1469+ context.paintChild (child! , offset);
1470+ layer = null ;
1471+ }
14671472 } else {
14681473 layer = null ;
14691474 }
@@ -1495,14 +1500,14 @@ class RenderClipRRect extends _RenderCustomClip<RRect> {
14951500 ///
14961501 /// If [clipper] is non-null, then [borderRadius] is ignored.
14971502 ///
1498- /// The [clipBehavior] argument must not be null or [Clip.none] .
1503+ /// The [clipBehavior] argument must not be null. If [clipBehavior] is
1504+ /// [Clip.none] , no clipping will be applied.
14991505 RenderClipRRect ({
15001506 RenderBox ? child,
15011507 BorderRadius borderRadius = BorderRadius .zero,
15021508 CustomClipper <RRect >? clipper,
15031509 Clip clipBehavior = Clip .antiAlias,
15041510 }) : assert (clipBehavior != null ),
1505- assert (clipBehavior != Clip .none),
15061511 _borderRadius = borderRadius,
15071512 super (child: child, clipper: clipper, clipBehavior: clipBehavior) {
15081513 assert (_borderRadius != null || clipper != null );
@@ -1541,14 +1546,21 @@ class RenderClipRRect extends _RenderCustomClip<RRect> {
15411546 @override
15421547 void paint (PaintingContext context, Offset offset) {
15431548 if (child != null ) {
1544- _updateClip ();
1545- layer = context.pushClipRRect (
1546- needsCompositing,
1547- offset,
1548- _clip! .outerRect,
1549- _clip! ,
1550- super .paint, clipBehavior: clipBehavior, oldLayer: layer as ClipRRectLayer ? ,
1551- );
1549+ if (clipBehavior != Clip .none) {
1550+ _updateClip ();
1551+ layer = context.pushClipRRect (
1552+ needsCompositing,
1553+ offset,
1554+ _clip! .outerRect,
1555+ _clip! ,
1556+ super .paint,
1557+ clipBehavior: clipBehavior,
1558+ oldLayer: layer as ClipRRectLayer ? ,
1559+ );
1560+ } else {
1561+ context.paintChild (child! , offset);
1562+ layer = null ;
1563+ }
15521564 } else {
15531565 layer = null ;
15541566 }
@@ -1578,13 +1590,13 @@ class RenderClipOval extends _RenderCustomClip<Rect> {
15781590 /// If [clipper] is null, the oval will be inscribed into the layout size and
15791591 /// position of the child.
15801592 ///
1581- /// The [clipBehavior] argument must not be null or [Clip.none] .
1593+ /// The [clipBehavior] argument must not be null. If [clipBehavior] is
1594+ /// [Clip.none] , no clipping will be applied.
15821595 RenderClipOval ({
15831596 RenderBox ? child,
15841597 CustomClipper <Rect >? clipper,
15851598 Clip clipBehavior = Clip .antiAlias,
15861599 }) : assert (clipBehavior != null ),
1587- assert (clipBehavior != Clip .none),
15881600 super (child: child, clipper: clipper, clipBehavior: clipBehavior);
15891601
15901602 Rect ? _cachedRect;
@@ -1620,16 +1632,21 @@ class RenderClipOval extends _RenderCustomClip<Rect> {
16201632 @override
16211633 void paint (PaintingContext context, Offset offset) {
16221634 if (child != null ) {
1623- _updateClip ();
1624- layer = context.pushClipPath (
1625- needsCompositing,
1626- offset,
1627- _clip! ,
1628- _getClipPath (_clip! ),
1629- super .paint,
1630- clipBehavior: clipBehavior,
1631- oldLayer: layer as ClipPathLayer ? ,
1632- );
1635+ if (clipBehavior != Clip .none) {
1636+ _updateClip ();
1637+ layer = context.pushClipPath (
1638+ needsCompositing,
1639+ offset,
1640+ _clip! ,
1641+ _getClipPath (_clip! ),
1642+ super .paint,
1643+ clipBehavior: clipBehavior,
1644+ oldLayer: layer as ClipPathLayer ? ,
1645+ );
1646+ } else {
1647+ context.paintChild (child! , offset);
1648+ layer = null ;
1649+ }
16331650 } else {
16341651 layer = null ;
16351652 }
@@ -1667,13 +1684,13 @@ class RenderClipPath extends _RenderCustomClip<Path> {
16671684 /// consider using a [RenderClipRect] , which can achieve the same effect more
16681685 /// efficiently.
16691686 ///
1670- /// The [clipBehavior] argument must not be null or [Clip.none] .
1687+ /// The [clipBehavior] argument must not be null. If [clipBehavior] is
1688+ /// [Clip.none] , no clipping will be applied.
16711689 RenderClipPath ({
16721690 RenderBox ? child,
16731691 CustomClipper <Path >? clipper,
16741692 Clip clipBehavior = Clip .antiAlias,
16751693 }) : assert (clipBehavior != null ),
1676- assert (clipBehavior != Clip .none),
16771694 super (child: child, clipper: clipper, clipBehavior: clipBehavior);
16781695
16791696 @override
@@ -1693,16 +1710,21 @@ class RenderClipPath extends _RenderCustomClip<Path> {
16931710 @override
16941711 void paint (PaintingContext context, Offset offset) {
16951712 if (child != null ) {
1696- _updateClip ();
1697- layer = context.pushClipPath (
1698- needsCompositing,
1699- offset,
1700- Offset .zero & size,
1701- _clip! ,
1702- super .paint,
1703- clipBehavior: clipBehavior,
1704- oldLayer: layer as ClipPathLayer ? ,
1705- );
1713+ if (clipBehavior != Clip .none) {
1714+ _updateClip ();
1715+ layer = context.pushClipPath (
1716+ needsCompositing,
1717+ offset,
1718+ Offset .zero & size,
1719+ _clip! ,
1720+ super .paint,
1721+ clipBehavior: clipBehavior,
1722+ oldLayer: layer as ClipPathLayer ? ,
1723+ );
1724+ } else {
1725+ context.paintChild (child! , offset);
1726+ layer = null ;
1727+ }
17061728 } else {
17071729 layer = null ;
17081730 }
0 commit comments