Skip to content

Conversation

@ahmedsameha1
Copy link
Contributor

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

@github-actions github-actions bot added the a: text input Entering text in a text field or keyboard related problems label Nov 9, 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 TextButton does not crash when placed in a zero-sized container. The test correctly reproduces the scenario by placing a TextButton inside a SizedBox.shrink() and verifies that no crash occurs during widget pumping. My feedback includes a suggestion to consider relocating the test to a more appropriate test suite for better code organization.

Comment on lines 54 to 65
testWidgets('TextButton does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Center(
child: SizedBox.shrink(
child: TextButton(onPressed: () {}, child: const Text('X')),
),
),
),
);
expect(tester.getSize(find.byType(TextButton)), Size.zero);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This is a good regression test for the issue. However, this test appears to be for a core behavior of the TextButton widget itself, while other tests in this file are specific to the TextButtonUseCase. To improve code organization and discoverability for future developers, please consider moving this test to the main test file for TextButton, which is likely packages/flutter/test/material/text_button_test.dart.

@ahmedsameha1 ahmedsameha1 force-pushed the handle#6537-TextButton branch from f5fe037 to 4db66c9 Compare November 9, 2025 12:55
@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Nov 9, 2025
@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 b705072 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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 11, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 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