Skip to content

Commit ed8758b

Browse files
ahmedsameha1IvoneDjaja
authored andcommitted
Make sure that a TextButton doesn't crash in 0x0 environment (flutter#178213)
This is my attempt to handle flutter#6537 for the TextButton widget.
1 parent 40b0723 commit ed8758b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/flutter/test/material/text_button_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,4 +2680,17 @@ void main() {
26802680
// The button should still be focused.
26812681
expect(getButtonFocusNode().hasFocus, true);
26822682
});
2683+
2684+
testWidgets('TextButton does not crash at zero area', (WidgetTester tester) async {
2685+
await tester.pumpWidget(
2686+
MaterialApp(
2687+
home: Center(
2688+
child: SizedBox.shrink(
2689+
child: TextButton(onPressed: () {}, child: const Text('X')),
2690+
),
2691+
),
2692+
),
2693+
);
2694+
expect(tester.getSize(find.byType(TextButton)), Size.zero);
2695+
});
26832696
}

0 commit comments

Comments
 (0)