Remove clipBehavior == Clip.none conditions (#98503)

This commit is contained in:
Taha Tesser 2022-02-18 11:29:16 +02:00 committed by GitHub
parent 0ed7fc88fa
commit c504797c42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 24 deletions

View File

@ -293,13 +293,11 @@ class CupertinoFormSection extends StatelessWidget {
), ),
Padding( Padding(
padding: margin, padding: margin,
child: clipBehavior == Clip.none child: ClipRRect(
? decoratedChildrenGroup borderRadius: childrenGroupBorderRadius,
: ClipRRect( clipBehavior: clipBehavior,
borderRadius: childrenGroupBorderRadius, child: decoratedChildrenGroup,
clipBehavior: clipBehavior, ),
child: decoratedChildrenGroup,
),
), ),
if (footer != null) if (footer != null)
Align( Align(

View File

@ -450,9 +450,6 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
shape: shape, shape: shape,
child: contents, child: contents,
); );
if (clipBehavior == Clip.none) {
return child;
}
return ClipPath( return ClipPath(
clipper: ShapeBorderClipper( clipper: ShapeBorderClipper(
shape: shape, shape: shape,

View File

@ -1103,14 +1103,10 @@ class _InteractiveViewerBuilt extends StatelessWidget {
); );
} }
if (clipBehavior != Clip.none) { return ClipRect(
child = ClipRect( clipBehavior: clipBehavior,
clipBehavior: clipBehavior, child: child,
child: child, );
);
}
return child;
} }
} }

View File

@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
@ -163,6 +164,7 @@ void main() {
), ),
); );
expect(find.byType(ClipRRect), findsNothing); final RenderClipRRect renderClip = tester.allRenderObjects.whereType<RenderClipRRect>().first;
expect(renderClip.clipBehavior, equals(Clip.none));
}); });
} }

View File

@ -420,7 +420,8 @@ void main() {
), ),
); );
expect(find.byKey(materialKey), hasNoImmediateClip); final RenderClipPath renderClip = tester.allRenderObjects.whereType<RenderClipPath>().first;
expect(renderClip.clipBehavior, equals(Clip.none));
}); });
testWidgets('clips to bounding rect by default given Clip.antiAlias', (WidgetTester tester) async { testWidgets('clips to bounding rect by default given Clip.antiAlias', (WidgetTester tester) async {

View File

@ -6,6 +6,7 @@ import 'dart:math' as math;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:vector_math/vector_math_64.dart' show Quad, Vector3, Matrix4; import 'package:vector_math/vector_math_64.dart' show Quad, Vector3, Matrix4;
@ -1168,10 +1169,8 @@ void main() {
), ),
); );
expect( final RenderClipRect renderClip = tester.allRenderObjects.whereType<RenderClipRect>().first;
find.byType(ClipRect), expect(renderClip.clipBehavior, equals(Clip.none));
findsNothing,
);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(