Repository: flutter/flutter
File: packages/flutter/test/widgets/overlay_portal_test.dart (Dart)

Code before:
        ),
      ),
    );
    expect(buildCount, 1);
    expect(directionSeenByOverlayChild, textDirection);

    setState(() {
      textDirection = TextDirection.ltr;
    });
    await tester.pump();
    expect(buildCount, 2);
    expect(directionSeenByOverlayChild, textDirection);
  });

  testWidgets('OverlayPortal overlayChild receives MediaQuery properties from Overlay context', (WidgetTester tester) async {
    final OverlayPortalController controller = OverlayPortalController();
    final EdgeInsets expectedPadding = EdgeInsets.all(10);
    final EdgeInsets expectedViewInsets = EdgeInsets.only(bottom: 300);
    final EdgeInsets expectedViewPadding = EdgeInsets.only(top: 50, bottom: 20);
    final Size expectedSize = Size(800, 600);

    MediaQueryData? overlayChildData;

    await tester.pumpWidget(
      MediaQuery(
        data: MediaQueryData(
          padding: expectedPadding,
          viewInsets: expectedViewInsets,
          viewPadding: expectedViewPadding,
          size: expectedSize,
        ),
        child: Directionality(
          textDirection: TextDirection.ltr,
          child: Overlay(
            initialEntries: <OverlayEntry>[
              OverlayEntry(
                builder: (BuildContext context) {
                  return MediaQuery(
                    data: MediaQuery.of(context).copyWith(
                      padding: EdgeInsets.zero,
                      viewInsets: EdgeInsets.zero,
                      viewPadding: EdgeInsets.zero,
                    ),
                    child: OverlayPortal(
                      controller: controller,
                      overlayChildBuilder: (BuildContext context) {
                        overlayChildData = MediaQuery.of(context);
                        return const SizedBox();
                      },
                      child: const SizedBox(),
                    ),

Review comment (suggestion):
```suggestion
        data: const MediaQueryData(
```

Code after:
        ),
      ),
    );
    expect(buildCount, 1);
    expect(directionSeenByOverlayChild, textDirection);

    setState(() {
      textDirection = TextDirection.ltr;
    });
    await tester.pump();
    expect(buildCount, 2);
    expect(directionSeenByOverlayChild, textDirection);
  });

  testWidgets(
    'OverlayPortal overlayChild located in root Overlay receives MediaQuery properties from root Overlay context',
    (WidgetTester tester) async {
      final controller = OverlayPortalController();
      const rootPadding = EdgeInsets.all(10);
      const innerPadding = EdgeInsets.all(20);

      MediaQueryData? overlayChildData;
      OverlayEntry? outerEntry;
      OverlayEntry? innerEntry;
      addTearDown(() {
        outerEntry?.remove();
        outerEntry?.dispose();
        innerEntry?.remove();
        innerEntry?.dispose();
      });

      await tester.pumpWidget(
        MediaQuery(
          data: const MediaQueryData(padding: rootPadding),
          child: Directionality(
            textDirection: TextDirection.ltr,
            child: Overlay(
              initialEntries: <OverlayEntry>[
                outerEntry = OverlayEntry(
                  builder: (BuildContext context) {
                    return MediaQuery(
                      data: const MediaQueryData(padding: innerPadding),
                      child: Overlay(
                        initialEntries: <OverlayEntry>[
                          innerEntry = OverlayEntry(
                            builder: (BuildContext context) {
                              return OverlayPortal(
                                controller: controller,
                                overlayLocation: OverlayChildLocation.rootOverlay,
                                overlayChildBuilder: (BuildContext context) {
                                  overlayChildData = MediaQuery.of(context);