Make sure that an AnimatedSize doesn't crash in 0x0 environment (#180174)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the AnimatedSize
widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
diff --git a/packages/flutter/test/widgets/animated_size_test.dart b/packages/flutter/test/widgets/animated_size_test.dart
index 31e1cb7..536bc84 100644
--- a/packages/flutter/test/widgets/animated_size_test.dart
+++ b/packages/flutter/test/widgets/animated_size_test.dart
@@ -489,4 +489,18 @@
       );
     });
   });
+
+  testWidgets('AnimatedSize does not crash at zero size', (WidgetTester tester) async {
+    await tester.pumpWidget(
+      const Directionality(
+        textDirection: TextDirection.ltr,
+        child: Center(
+          child: SizedBox.shrink(
+            child: AnimatedSize(duration: Duration(milliseconds: 300), child: Text('X')),
+          ),
+        ),
+      ),
+    );
+    expect(tester.getSize(find.byType(AnimatedSize)), Size.zero);
+  });
 }