Make sure that an AnimatedAlign doesn't crash in 0x0 environment (#181361)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the AnimatedAlign
widget.
This commit is contained in:
Ahmed Mohamed Sameh 2026-01-28 00:10:04 +02:00 committed by GitHub
parent 1c0ccb5ce6
commit 2e64b79fd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -146,4 +146,22 @@ void main() {
final RenderBox box = tester.renderObject<RenderBox>(find.byType(SizedBox).last);
expect(box.size, equals(const Size(100.0, 100)));
});
testWidgets('AnimatedAlign does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox.shrink(
child: AnimatedAlign(
alignment: Alignment.bottomCenter,
duration: Duration(milliseconds: 50),
),
),
),
),
);
await tester.pumpAndSettle();
expect(tester.getSize(find.byType(AnimatedAlign)), Size.zero);
});
}