Make sure that an AnimatedCrossFade does not crash in 0x0 environment (#180088)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the AnimatedCrossFade
widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
This commit is contained in:
Ahmed Mohamed Sameh 2025-12-27 02:12:17 +02:00 committed by GitHub
parent a35e01c8e7
commit eb2e689a69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -396,6 +396,25 @@ void main() {
expect(numberOfTouchEventNoticed, 1);
});
testWidgets('AnimatedCrossFade does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox.shrink(
child: AnimatedCrossFade(
firstChild: Text('X'),
secondChild: Text('Y'),
crossFadeState: CrossFadeState.showFirst,
duration: Duration(seconds: 1),
),
),
),
),
);
expect(tester.getSize(find.byType(AnimatedCrossFade)), Size.zero);
});
}
class _TickerWatchingWidget extends StatefulWidget {