Make sure that an AnimatedPadding doesn't crash in 0x0 environment (#181235)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the AnimatedPadding
widget.
This commit is contained in:
Ahmed Mohamed Sameh 2026-01-28 01:05:02 +02:00 committed by GitHub
parent 7a84ebcc57
commit a01a411a91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -100,4 +100,24 @@ void main() {
expect(tester.getSize(find.byKey(target)), const Size(800.0, 600.0));
expect(tester.getTopRight(find.byKey(target)), const Offset(800.0, 0.0));
});
testWidgets('AnimatedPadding does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox.shrink(
child: AnimatedPadding(
duration: const Duration(milliseconds: 200),
padding: const EdgeInsets.all(1),
child: const Text('X'),
),
),
),
),
);
await tester.pump(const Duration(milliseconds: 100));
await tester.pumpAndSettle();
expect(tester.getSize(find.byType(AnimatedPadding)), Size.zero);
});
}