Skip to content

Conversation

@ahmedsameha1
Copy link
Contributor

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

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Nov 10, 2025
Copy link
Contributor

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

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 adds a regression test to ensure that a TextField does not crash when it has a zero-size area. The test case correctly simulates the scenario by setting the view's physical size to zero and then triggering a selection change. My feedback includes a minor suggestion to improve test hygiene by reordering the addTearDown calls to follow the recommended resource cleanup order.

Comment on lines 18906 to 18907
addTearDown(controller.dispose);
addTearDown(tester.view.reset);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For better test hygiene, it's generally safer to dispose of resources in the reverse order of their allocation. In this test, the TextEditingController is created after the tester.view is modified. Therefore, the controller should be disposed of before resetting the view.

The addTearDown function executes callbacks in the reverse order of their registration. To ensure controller.dispose() is called before tester.view.reset(), you should register tester.view.reset first.1

    addTearDown(tester.view.reset);
    addTearDown(controller.dispose);

Style Guide References

Footnotes

@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 11, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Nov 11, 2025
Merged via the queue into flutter:master with commit 951b3ca Nov 11, 2025
76 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 11, 2025
IvoneDjaja pushed a commit to IvoneDjaja/flutter that referenced this pull request Nov 22, 2025
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants