Unverified Commit 9d7bdb59 authored by Yuqian Li's avatar Yuqian Li Committed by GitHub

Default FittedBox's clipBehavior to none (#66700)

This is a continuation of https://github.com/flutter/flutter/pull/61366
after cl/333620714

See also https://flutter.dev/go/clip-behavior
parent 47288927
...@@ -1424,7 +1424,7 @@ class FittedBox extends SingleChildRenderObjectWidget { ...@@ -1424,7 +1424,7 @@ class FittedBox extends SingleChildRenderObjectWidget {
Key? key, Key? key,
this.fit = BoxFit.contain, this.fit = BoxFit.contain,
this.alignment = Alignment.center, this.alignment = Alignment.center,
this.clipBehavior = Clip.hardEdge, this.clipBehavior = Clip.none,
Widget? child, Widget? child,
}) : assert(fit != null), }) : assert(fit != null),
assert(alignment != null), assert(alignment != null),
...@@ -1452,7 +1452,7 @@ class FittedBox extends SingleChildRenderObjectWidget { ...@@ -1452,7 +1452,7 @@ class FittedBox extends SingleChildRenderObjectWidget {
/// {@macro flutter.widgets.Clip} /// {@macro flutter.widgets.Clip}
/// ///
/// Defaults to [Clip.hardEdge]. /// Defaults to [Clip.none].
final Clip clipBehavior; final Clip clipBehavior;
@override @override
......
...@@ -481,7 +481,7 @@ void main() { ...@@ -481,7 +481,7 @@ void main() {
testWidgets('Can set and update clipBehavior', (WidgetTester tester) async { testWidgets('Can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(FittedBox(fit: BoxFit.none, child: Container())); await tester.pumpWidget(FittedBox(fit: BoxFit.none, child: Container()));
final RenderFittedBox renderObject = tester.allRenderObjects.whereType<RenderFittedBox>().first; final RenderFittedBox renderObject = tester.allRenderObjects.whereType<RenderFittedBox>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge)); expect(renderObject.clipBehavior, equals(Clip.none));
await tester.pumpWidget(FittedBox(fit: BoxFit.none, child: Container(), clipBehavior: Clip.antiAlias)); await tester.pumpWidget(FittedBox(fit: BoxFit.none, child: Container(), clipBehavior: Clip.antiAlias));
expect(renderObject.clipBehavior, equals(Clip.antiAlias)); expect(renderObject.clipBehavior, equals(Clip.antiAlias));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment