Make sure that a WidgetsApp doesn't crash in 0x0 environment (#180224)
This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the WidgetsApp
widget.
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
diff --git a/packages/flutter/test/widgets/app_test.dart b/packages/flutter/test/widgets/app_test.dart
index 48bf5d7..b458d9e 100644
--- a/packages/flutter/test/widgets/app_test.dart
+++ b/packages/flutter/test/widgets/app_test.dart
@@ -778,6 +778,17 @@
variant: const TargetPlatformVariant(<TargetPlatform>{TargetPlatform.android}),
);
});
+
+ testWidgets('WidgetsApp does not crash at zero area', (WidgetTester tester) async {
+ await tester.pumpWidget(
+ Center(
+ child: SizedBox.shrink(
+ child: WidgetsApp(builder: (_, _) => const Text('X'), color: const Color(0xFFAABBCC)),
+ ),
+ ),
+ );
+ expect(tester.getSize(find.byType(WidgetsApp)), Size.zero);
+ });
}
typedef SimpleRouterDelegateBuilder =