Skip to content

Commit 604bc86

Browse files
Make sure that a CheckboxListTile doesn't crash in 0x0 environment (flutter#173151)
This is my attempt to handle flutter#6537 for the CheckboxListTile UI control. Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
1 parent 93999e1 commit 604bc86

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/flutter/test/material/checkbox_list_tile_test.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,23 @@ void main() {
18431843
expect(checkboxOffset.dy - tileOffset.dy, bottomPositionCheckbox);
18441844
expect(secondaryOffset.dy - tileOffset.dy, bottomPositionSecondary);
18451845
});
1846+
1847+
testWidgets('CheckboxListTile does not crash at zero area', (WidgetTester tester) async {
1848+
await tester.pumpWidget(
1849+
MaterialApp(
1850+
home: Center(
1851+
child: SizedBox.shrink(
1852+
child: Scaffold(
1853+
body: wrap(
1854+
child: CheckboxListTile(value: true, onChanged: (_) {}, title: const Text('X')),
1855+
),
1856+
),
1857+
),
1858+
),
1859+
),
1860+
);
1861+
expect(tester.getSize(find.byType(CheckboxListTile)), Size.zero);
1862+
});
18461863
}
18471864

18481865
class _SelectedGrabMouseCursor extends WidgetStateMouseCursor {

0 commit comments

Comments
 (0)