Skip to content

Commit ab47943

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

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/flutter/test/material/range_slider_test.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,6 +3782,21 @@ void main() {
37823782
..paragraph(),
37833783
);
37843784
});
3785+
3786+
testWidgets('RangeSlider does not crash at zero area', (WidgetTester tester) async {
3787+
await tester.pumpWidget(
3788+
MaterialApp(
3789+
home: Scaffold(
3790+
body: Center(
3791+
child: SizedBox.shrink(
3792+
child: RangeSlider(values: const RangeValues(0, 1), onChanged: (_) {}),
3793+
),
3794+
),
3795+
),
3796+
),
3797+
);
3798+
expect(tester.getSize(find.byType(RangeSlider)), Size.zero);
3799+
});
37853800
}
37863801

37873802
// A value indicator shape to log labelPainter text.

0 commit comments

Comments
 (0)