Skip to content

Commit a52e28e

Browse files
Make sure that an OutlinedButton doesn't crash in 0x0 environment (flutter#177340)
This is my attempt to handle flutter#6537 for the OutlinedButton widget. Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
1 parent 285e6f0 commit a52e28e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/flutter/test/material/outlined_button_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,4 +3076,17 @@ void main() {
30763076
// The button should still be focused.
30773077
expect(getButtonFocusNode().hasFocus, true);
30783078
});
3079+
3080+
testWidgets('OutlinedButton does not crash at zero area', (WidgetTester tester) async {
3081+
await tester.pumpWidget(
3082+
MaterialApp(
3083+
home: Center(
3084+
child: SizedBox.shrink(
3085+
child: OutlinedButton(onPressed: () {}, child: const Text('X')),
3086+
),
3087+
),
3088+
),
3089+
);
3090+
expect(tester.getSize(find.byType(OutlinedButton)), Size.zero);
3091+
});
30793092
}

0 commit comments

Comments
 (0)