Make sure that a TabBarView doesn't crash in 0x0 environment (#178202)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the TabBarView
widget.
This commit is contained in:
Ahmed Mohamed Sameh 2025-11-12 22:17:55 +02:00 committed by GitHub
parent 640fe715be
commit 8758971f69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9347,6 +9347,24 @@ void main() {
expect(tester.takeException(), isNull);
});
testWidgets('TabBarView does not crash at zero area', (WidgetTester tester) async {
tester.view.physicalSize = Size.zero;
final TabController controller = TabController(length: 2, vsync: tester);
addTearDown(tester.view.reset);
addTearDown(controller.dispose);
await tester.pumpWidget(
MaterialApp(
home: Center(
child: TabBarView(controller: controller, children: const <Widget>[Text('X'), Text('Y')]),
),
),
);
expect(tester.getSize(find.byType(TabBarView)), Size.zero);
controller.animateTo(1);
await tester.pump();
await tester.pumpAndSettle();
});
testWidgets('TabPageSelectorIndicator does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(