safeAreaTestValue property

set safeAreaTestValue (EdgeInsets safeArea)

convenience wrapper for configuring the padding

safeArea specifies the safe area insets for all 4 edges that you wish to simulate

Example

testWidgets('Test with safe area', (tester) async {
  tester.view.safeAreaTestValue = const EdgeInsets.all(10);
  await tester.pumpWidget(const TestApp());
  expect(find.text('Hello, World!'), findsOneWidget);
});

Implementation

set safeAreaTestValue(EdgeInsets safeArea) {
  padding = FakeViewPadding(
    bottom: safeArea.bottom,
    left: safeArea.left,
    right: safeArea.right,
    top: safeArea.top,
  );
}