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: margin,
child: clipBehavior == Clip.none
? decoratedChildrenGroup
: ClipRRect(
borderRadius: childrenGroupBorderRadius,
clipBehavior: clipBehavior,
child: decoratedChildrenGroup,
),
child: ClipRRect(
borderRadius: childrenGroupBorderRadius,
clipBehavior: clipBehavior,
child: decoratedChildrenGroup,
),
),
if (footer != null)
Align(

View File

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

View File

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

View File

@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'package:flutter/cupertino.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
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 {

View File

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