Skip to content

Make sure that an AnimatedSize doesn't crash in 0x0 environment - #180174

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
ahmedsameha1:handle#6537-AnimatedSize
Dec 27, 2025
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
ahmedsameha1:handle#6537-AnimatedSize

Conversation

@ahmedsameha1

Copy link
Copy Markdown
Contributor

This is my attempt to handle #6537 for the AnimatedSize widget.

@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Dec 21, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new test case for the AnimatedSize widget to prevent crashes in a zero-size environment. The test is a positive addition. My review includes a suggestion to correct a minor typo in the test description and to expand the test coverage to include animations to and from a zero size, which would more closely align with the scenario described in the original issue and make the test suite more robust.

Comment on lines +493 to +505
testWidgets('AinmatedSize does not crash at zero size', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox.shrink(
child: AnimatedSize(duration: Duration(milliseconds: 300), child: Text('X')),
),
),
),
);
expect(tester.getSize(find.byType(AnimatedSize)), Size.zero);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This test is a good start for ensuring AnimatedSize handles zero-size environments. I have a couple of suggestions for improvement:

  1. There's a small typo in the test description on line 493: AinmatedSize should be AnimatedSize.

  2. This test only covers the initial build scenario where the constraints are tight and zero from the beginning. The crash described in the associated issue occurs during size transitions. To make this test more robust, please consider adding scenarios that animate the size to and from zero. For example, by updating the child of AnimatedSize from a non-zero sized widget to a zero-sized one (like SizedBox.shrink()) and vice-versa, then pumping the animation.

});
});

testWidgets('AinmatedSize does not crash at zero size', (WidgetTester tester) async {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a small typo in the test description. It should be AnimatedSize.

Suggested change
testWidgets('AinmatedSize does not crash at zero size', (WidgetTester tester) async {
testWidgets('AnimatedSize does not crash at zero size', (WidgetTester tester) async {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tanks

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uauu

@ahmedsameha1
ahmedsameha1 force-pushed the handle#6537-AnimatedSize branch from a9a399d to daafcbc Compare December 23, 2025 09:30

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist:

  • The test is in the correct file
  • The test name goes “does not crash at zero area”
  • The target widget is wrapped by Center (or is fullscreen)
  • The target widget does not have an overlay, or the overlay is tested
  • The target widget is expected to have a size of exactly Size.zero

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 26, 2025
@auto-submit
auto-submit Bot added this pull request to the merge queue Dec 27, 2025
Merged via the queue into flutter:master with commit 935eda8 Dec 27, 2025
71 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 29, 2025
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Dec 29, 2025
Roll Flutter from 6ff7f30 to 60d8165 (32 revisions)

flutter/flutter@6ff7f30...60d8165

2025-12-29 [email protected] Roll Fuchsia Linux SDK from xn1U9DUFEpB4f6vG-... to DdllqZRZYriOd7Q8v... (flutter/flutter#180356)
2025-12-28 [email protected] Roll Dart SDK from 17d51009282c to df175c998021 (1 revision) (flutter/flutter#180349)
2025-12-28 [email protected] Roll Dart SDK from d4a92c2c69bf to 17d51009282c (1 revision) (flutter/flutter#180346)
2025-12-28 [email protected] Roll Fuchsia Linux SDK from jVkEEUxyGeemuu2HE... to xn1U9DUFEpB4f6vG-... (flutter/flutter#180343)
2025-12-27 [email protected] Roll Dart SDK from 3b84125003a1 to d4a92c2c69bf (1 revision) (flutter/flutter#180331)
2025-12-27 [email protected] Roll Skia from e6e535aec613 to c29a475066f5 (1 revision) (flutter/flutter#180322)
2025-12-27 [email protected] Make sure that a WidgetsApp doesn't crash in 0x0 environment (flutter/flutter#180224)
2025-12-27 [email protected] Make sure that an AnimatedSize doesn't crash in 0x0 environment (flutter/flutter#180174)
2025-12-27 [email protected] Make sure that an AnimatedGrid doesn't crash in 0x0 environment (flutter/flutter#180159)
2025-12-27 [email protected] Make sure that an AnimatedCrossFade does not crash in 0x0 environment (flutter/flutter#180088)
2025-12-27 [email protected] Make sure that an AnimatedList doesn't crash in 0x0 environment (flutter/flutter#180123)
2025-12-26 [email protected] Roll Fuchsia Linux SDK from mZlbuHta7S71Quawk... to jVkEEUxyGeemuu2HE... (flutter/flutter#180317)
2025-12-26 [email protected] Roll Dart SDK from 6b2c3716be54 to 3b84125003a1 (1 revision) (flutter/flutter#180316)
2025-12-26 [email protected] Roll Dart SDK from 18f6751c5ccc to 6b2c3716be54 (1 revision) (flutter/flutter#180252)
2025-12-26 [email protected] Roll Skia from 07c59737d265 to e6e535aec613 (1 revision) (flutter/flutter#180303)
2025-12-25 [email protected] Roll Fuchsia Linux SDK from 2q71ydbnIhmBUiNOF... to mZlbuHta7S71Quawk... (flutter/flutter#180290)
2025-12-25 [email protected] Roll Skia from 6d0a1b03e9c7 to 07c59737d265 (1 revision) (flutter/flutter#180289)
2025-12-25 [email protected] Roll Skia from 2b5d93b62a3f to 6d0a1b03e9c7 (1 revision) (flutter/flutter#180279)
2025-12-25 [email protected] Roll Skia from 3544942c9d42 to 2b5d93b62a3f (1 revision) (flutter/flutter#180276)
2025-12-24 [email protected] Roll Fuchsia Linux SDK from 5EgkVbjGVZmCFPdtR... to 2q71ydbnIhmBUiNOF... (flutter/flutter#180274)
2025-12-24 [email protected] Roll Packages from 5e3a766 to 2164da9 (4 revisions) (flutter/flutter#180271)
2025-12-24 [email protected] Roll Skia from 988a48f7a944 to 3544942c9d42 (1 revision) (flutter/flutter#180267)
2025-12-24 [email protected] Marks Mac_arm64_mokey native_assets_android to be unflaky (flutter/flutter#180263)
2025-12-24 [email protected] Roll Skia from 51a05ce05880 to 988a48f7a944 (1 revision) (flutter/flutter#180256)
2025-12-24 [email protected] fix: exclude semantics for disabled dates (flutter/flutter#178981)
2025-12-24 [email protected] Roll Skia from 7fe9b93153f8 to 51a05ce05880 (1 revision) (flutter/flutter#180253)
2025-12-24 [email protected] Enhance documentation for sortable column behavior (flutter/flutter#180011)
2025-12-24 [email protected] Roll Skia from a0f18947bc1b to 7fe9b93153f8 (4 revisions) (flutter/flutter#180247)
2025-12-23 [email protected] Roll Skia from bdb147ae3040 to a0f18947bc1b (2 revisions) (flutter/flutter#180241)
2025-12-23 [email protected] Roll Dart SDK from 94b05f717ba3 to 18f6751c5ccc (1 revision) (flutter/flutter#180236)
2025-12-23 [email protected] docs: clarify dropdown menu text clearing (flutter/flutter#179676)
2025-12-23 [email protected] New optimized general convex path shadow algorithm (flutter/flutter#178370)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
...
ivan-vanyusho pushed a commit to ivan-vanyusho/packages that referenced this pull request Jan 26, 2026
Roll Flutter from 6ff7f30 to 60d8165 (32 revisions)

flutter/flutter@6ff7f30...60d8165

2025-12-29 [email protected] Roll Fuchsia Linux SDK from xn1U9DUFEpB4f6vG-... to DdllqZRZYriOd7Q8v... (flutter/flutter#180356)
2025-12-28 [email protected] Roll Dart SDK from 17d51009282c to df175c998021 (1 revision) (flutter/flutter#180349)
2025-12-28 [email protected] Roll Dart SDK from d4a92c2c69bf to 17d51009282c (1 revision) (flutter/flutter#180346)
2025-12-28 [email protected] Roll Fuchsia Linux SDK from jVkEEUxyGeemuu2HE... to xn1U9DUFEpB4f6vG-... (flutter/flutter#180343)
2025-12-27 [email protected] Roll Dart SDK from 3b84125003a1 to d4a92c2c69bf (1 revision) (flutter/flutter#180331)
2025-12-27 [email protected] Roll Skia from e6e535aec613 to c29a475066f5 (1 revision) (flutter/flutter#180322)
2025-12-27 [email protected] Make sure that a WidgetsApp doesn't crash in 0x0 environment (flutter/flutter#180224)
2025-12-27 [email protected] Make sure that an AnimatedSize doesn't crash in 0x0 environment (flutter/flutter#180174)
2025-12-27 [email protected] Make sure that an AnimatedGrid doesn't crash in 0x0 environment (flutter/flutter#180159)
2025-12-27 [email protected] Make sure that an AnimatedCrossFade does not crash in 0x0 environment (flutter/flutter#180088)
2025-12-27 [email protected] Make sure that an AnimatedList doesn't crash in 0x0 environment (flutter/flutter#180123)
2025-12-26 [email protected] Roll Fuchsia Linux SDK from mZlbuHta7S71Quawk... to jVkEEUxyGeemuu2HE... (flutter/flutter#180317)
2025-12-26 [email protected] Roll Dart SDK from 6b2c3716be54 to 3b84125003a1 (1 revision) (flutter/flutter#180316)
2025-12-26 [email protected] Roll Dart SDK from 18f6751c5ccc to 6b2c3716be54 (1 revision) (flutter/flutter#180252)
2025-12-26 [email protected] Roll Skia from 07c59737d265 to e6e535aec613 (1 revision) (flutter/flutter#180303)
2025-12-25 [email protected] Roll Fuchsia Linux SDK from 2q71ydbnIhmBUiNOF... to mZlbuHta7S71Quawk... (flutter/flutter#180290)
2025-12-25 [email protected] Roll Skia from 6d0a1b03e9c7 to 07c59737d265 (1 revision) (flutter/flutter#180289)
2025-12-25 [email protected] Roll Skia from 2b5d93b62a3f to 6d0a1b03e9c7 (1 revision) (flutter/flutter#180279)
2025-12-25 [email protected] Roll Skia from 3544942c9d42 to 2b5d93b62a3f (1 revision) (flutter/flutter#180276)
2025-12-24 [email protected] Roll Fuchsia Linux SDK from 5EgkVbjGVZmCFPdtR... to 2q71ydbnIhmBUiNOF... (flutter/flutter#180274)
2025-12-24 [email protected] Roll Packages from 5e3a766 to 2164da9 (4 revisions) (flutter/flutter#180271)
2025-12-24 [email protected] Roll Skia from 988a48f7a944 to 3544942c9d42 (1 revision) (flutter/flutter#180267)
2025-12-24 [email protected] Marks Mac_arm64_mokey native_assets_android to be unflaky (flutter/flutter#180263)
2025-12-24 [email protected] Roll Skia from 51a05ce05880 to 988a48f7a944 (1 revision) (flutter/flutter#180256)
2025-12-24 [email protected] fix: exclude semantics for disabled dates (flutter/flutter#178981)
2025-12-24 [email protected] Roll Skia from 7fe9b93153f8 to 51a05ce05880 (1 revision) (flutter/flutter#180253)
2025-12-24 [email protected] Enhance documentation for sortable column behavior (flutter/flutter#180011)
2025-12-24 [email protected] Roll Skia from a0f18947bc1b to 7fe9b93153f8 (4 revisions) (flutter/flutter#180247)
2025-12-23 [email protected] Roll Skia from bdb147ae3040 to a0f18947bc1b (2 revisions) (flutter/flutter#180241)
2025-12-23 [email protected] Roll Dart SDK from 94b05f717ba3 to 18f6751c5ccc (1 revision) (flutter/flutter#180236)
2025-12-23 [email protected] docs: clarify dropdown menu text clearing (flutter/flutter#179676)
2025-12-23 [email protected] New optimized general convex path shadow algorithm (flutter/flutter#178370)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 11, 2026
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
Roll Flutter from 6ff7f30 to 60d8165 (32 revisions)

flutter/flutter@6ff7f30...60d8165

2025-12-29 [email protected] Roll Fuchsia Linux SDK from xn1U9DUFEpB4f6vG-... to DdllqZRZYriOd7Q8v... (flutter/flutter#180356)
2025-12-28 [email protected] Roll Dart SDK from 17d51009282c to df175c998021 (1 revision) (flutter/flutter#180349)
2025-12-28 [email protected] Roll Dart SDK from d4a92c2c69bf to 17d51009282c (1 revision) (flutter/flutter#180346)
2025-12-28 [email protected] Roll Fuchsia Linux SDK from jVkEEUxyGeemuu2HE... to xn1U9DUFEpB4f6vG-... (flutter/flutter#180343)
2025-12-27 [email protected] Roll Dart SDK from 3b84125003a1 to d4a92c2c69bf (1 revision) (flutter/flutter#180331)
2025-12-27 [email protected] Roll Skia from e6e535aec613 to c29a475066f5 (1 revision) (flutter/flutter#180322)
2025-12-27 [email protected] Make sure that a WidgetsApp doesn't crash in 0x0 environment (flutter/flutter#180224)
2025-12-27 [email protected] Make sure that an AnimatedSize doesn't crash in 0x0 environment (flutter/flutter#180174)
2025-12-27 [email protected] Make sure that an AnimatedGrid doesn't crash in 0x0 environment (flutter/flutter#180159)
2025-12-27 [email protected] Make sure that an AnimatedCrossFade does not crash in 0x0 environment (flutter/flutter#180088)
2025-12-27 [email protected] Make sure that an AnimatedList doesn't crash in 0x0 environment (flutter/flutter#180123)
2025-12-26 [email protected] Roll Fuchsia Linux SDK from mZlbuHta7S71Quawk... to jVkEEUxyGeemuu2HE... (flutter/flutter#180317)
2025-12-26 [email protected] Roll Dart SDK from 6b2c3716be54 to 3b84125003a1 (1 revision) (flutter/flutter#180316)
2025-12-26 [email protected] Roll Dart SDK from 18f6751c5ccc to 6b2c3716be54 (1 revision) (flutter/flutter#180252)
2025-12-26 [email protected] Roll Skia from 07c59737d265 to e6e535aec613 (1 revision) (flutter/flutter#180303)
2025-12-25 [email protected] Roll Fuchsia Linux SDK from 2q71ydbnIhmBUiNOF... to mZlbuHta7S71Quawk... (flutter/flutter#180290)
2025-12-25 [email protected] Roll Skia from 6d0a1b03e9c7 to 07c59737d265 (1 revision) (flutter/flutter#180289)
2025-12-25 [email protected] Roll Skia from 2b5d93b62a3f to 6d0a1b03e9c7 (1 revision) (flutter/flutter#180279)
2025-12-25 [email protected] Roll Skia from 3544942c9d42 to 2b5d93b62a3f (1 revision) (flutter/flutter#180276)
2025-12-24 [email protected] Roll Fuchsia Linux SDK from 5EgkVbjGVZmCFPdtR... to 2q71ydbnIhmBUiNOF... (flutter/flutter#180274)
2025-12-24 [email protected] Roll Packages from 5e3a766 to 2164da9 (4 revisions) (flutter/flutter#180271)
2025-12-24 [email protected] Roll Skia from 988a48f7a944 to 3544942c9d42 (1 revision) (flutter/flutter#180267)
2025-12-24 [email protected] Marks Mac_arm64_mokey native_assets_android to be unflaky (flutter/flutter#180263)
2025-12-24 [email protected] Roll Skia from 51a05ce05880 to 988a48f7a944 (1 revision) (flutter/flutter#180256)
2025-12-24 [email protected] fix: exclude semantics for disabled dates (flutter/flutter#178981)
2025-12-24 [email protected] Roll Skia from 7fe9b93153f8 to 51a05ce05880 (1 revision) (flutter/flutter#180253)
2025-12-24 [email protected] Enhance documentation for sortable column behavior (flutter/flutter#180011)
2025-12-24 [email protected] Roll Skia from a0f18947bc1b to 7fe9b93153f8 (4 revisions) (flutter/flutter#180247)
2025-12-23 [email protected] Roll Skia from bdb147ae3040 to a0f18947bc1b (2 revisions) (flutter/flutter#180241)
2025-12-23 [email protected] Roll Dart SDK from 94b05f717ba3 to 18f6751c5ccc (1 revision) (flutter/flutter#180236)
2025-12-23 [email protected] docs: clarify dropdown menu text clearing (flutter/flutter#179676)
2025-12-23 [email protected] New optimized general convex path shadow algorithm (flutter/flutter#178370)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants