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

Code before:
        await tester.tap(find.byKey(const ValueKey<int>(1)));
        expect(tappedChildren, const <int>[0, 1]);

        // The third child is not painted, so is not hit
        await tester.tap(find.byKey(const ValueKey<int>(2)), warnIfMissed: false);
        expect(tappedChildren, const <int>[0, 1]);
      },
    );
  });

  testWidgets('ListWheelScrollView creates only one opacity layer for all children', (
    WidgetTester tester,
  ) async {
    await tester.pumpWidget(
      ListWheelScrollView(
        overAndUnderCenterOpacity: 0.5,
        itemExtent: 20.0,
        children: <Widget>[for (int i = 0; i < 20; i++) Container()],
      ),
    );

    expect(tester.layers.whereType<OpacityLayer>(), hasLength(1));
  });

  // This is a regression test for https://github.com/flutter/flutter/issues/140780.
  // Tweaked to handle https://github.com/flutter/flutter/issues/6537
  testWidgets(
    'ListWheelScrollView in an AnimatedContainer with zero width and height does not throw an error',
    (WidgetTester tester) async {
      await tester.pumpWidget(
        MaterialApp(
          home: Scaffold(
            body: AnimatedContainer(
              width: 0,
              height: 0,
              duration: Duration.zero,
              child: ListWheelScrollView(
                itemExtent: 20.0,
                children: <Widget>[for (int i = 0; i < 20; i++) Container()],
              ),
            ),
          ),
        ),
      );

      expect(tester.takeException(), isNull);
      expect(tester.getSize(find.byType(ListWheelScrollView)), Size.zero);
      expect(tester.getSize(find.byType(ListWheelViewport)), Size.zero);
    },
  );
}

Review comment (suggestion):
Nit:
```suggestion
  // This is a regression test for https://github.com/flutter/flutter/issues/140780
  // and https://github.com/flutter/flutter/issues/6537.
```

Code after:
        await tester.tap(find.byKey(const ValueKey<int>(1)));
        expect(tappedChildren, const <int>[0, 1]);

        // The third child is not painted, so is not hit
        await tester.tap(find.byKey(const ValueKey<int>(2)), warnIfMissed: false);
        expect(tappedChildren, const <int>[0, 1]);
      },
    );
  });

  testWidgets('ListWheelScrollView creates only one opacity layer for all children', (
    WidgetTester tester,
  ) async {
    await tester.pumpWidget(
      ListWheelScrollView(
        overAndUnderCenterOpacity: 0.5,
        itemExtent: 20.0,
        children: <Widget>[for (int i = 0; i < 20; i++) Container()],
      ),
    );

    expect(tester.layers.whereType<OpacityLayer>(), hasLength(1));
  });

  // This is a regression test for https://github.com/flutter/flutter/issues/140780.
  // and https://github.com/flutter/flutter/issues/6537.
  testWidgets(
    'ListWheelScrollView in an AnimatedContainer with zero width and height does not throw an error',
    (WidgetTester tester) async {
      await tester.pumpWidget(
        MaterialApp(
          home: Scaffold(
            body: AnimatedContainer(
              width: 0,
              height: 0,
              duration: Duration.zero,
              child: ListWheelScrollView(
                itemExtent: 20.0,
                children: <Widget>[for (int i = 0; i < 20; i++) Container()],
              ),
            ),
          ),
        ),
      );

      expect(tester.takeException(), isNull);
      expect(tester.getSize(find.byType(ListWheelScrollView)), Size.zero);
      expect(tester.getSize(find.byType(ListWheelViewport)), Size.zero);
    },
  );
}