@@ -2652,27 +2652,35 @@ void main() {
26522652 (WidgetTester tester) async {
26532653 debugDisableShadows = false ;
26542654 try {
2655- await tester.pumpWidget (_buildSilderApp ());
2656-
2657- final RenderBox valueIndicatorBox =
2658- tester.renderObject (find.byType (Overlay ));
2659-
2660- // Calculate a specific position on the Slider
2661- final Rect sliderRect = tester.getRect (find.byType (Slider ));
2662- final Offset tapPositionLeft = Offset (
2663- sliderRect.left + sliderRect.width * 0.25 , sliderRect.center.dy);
2664- final Offset tapPositionRight = Offset (
2665- sliderRect.left + sliderRect.width * 0.75 , sliderRect.center.dy);
2666-
2667- // Tap on the 25% position of the Slider
2668- await tester.tapAt (tapPositionLeft);
2669- await tester.pumpAndSettle ();
2670- expect (valueIndicatorBox, paintsExactlyCountTimes (#drawPath, 1 ));
2655+ final List <SliderComponentShape > shapes = [
2656+ const PaddleSliderValueIndicatorShape (),
2657+ const DropSliderValueIndicatorShape (),
2658+ const RectangularSliderValueIndicatorShape (),
2659+ ];
2660+
2661+ for (final SliderComponentShape element in shapes) {
2662+ await tester.pumpWidget (_buildSilderApp (element));
2663+
2664+ final RenderBox valueIndicatorBox =
2665+ tester.renderObject (find.byType (Overlay ));
2666+
2667+ // Calculate a specific position on the Slider
2668+ final Rect sliderRect = tester.getRect (find.byType (Slider ));
2669+ final Offset tapPositionLeft = Offset (
2670+ sliderRect.left + sliderRect.width * 0.25 , sliderRect.center.dy);
2671+ final Offset tapPositionRight = Offset (
2672+ sliderRect.left + sliderRect.width * 0.75 , sliderRect.center.dy);
2673+
2674+ // Tap on the 25% position of the Slider
2675+ await tester.tapAt (tapPositionLeft);
2676+ await tester.pumpAndSettle ();
2677+ expect (valueIndicatorBox, paintsExactlyCountTimes (#drawPath, 1 ));
26712678
2672- // Tap on the 75% position of the Slider
2673- await tester.tapAt (tapPositionRight);
2674- await tester.pumpAndSettle ();
2675- expect (valueIndicatorBox, paintsExactlyCountTimes (#drawPath, 0 ));
2679+ // Tap on the 75% position of the Slider
2680+ await tester.tapAt (tapPositionRight);
2681+ await tester.pumpAndSettle ();
2682+ expect (valueIndicatorBox, paintsExactlyCountTimes (#drawPath, 0 ));
2683+ }
26762684 } finally {
26772685 debugDisableShadows = true ;
26782686 }
@@ -2751,22 +2759,27 @@ Widget _buildRangeApp(
27512759 ),
27522760 );
27532761}
2754- Widget _buildSilderApp () {
2762+ Widget _buildSilderApp (SliderComponentShape sliderComponentShape ) {
27552763 double sliderValue = 10 ;
27562764 return MaterialApp (
27572765 home: StatefulBuilder (
27582766 builder: (BuildContext context, void Function (void Function ()) setState) {
27592767 return Material (
2760- child: Slider (
2761- value: sliderValue,
2762- max: 100 ,
2763- label: sliderValue > 50 ? null : sliderValue.toString (),
2764- divisions: 10 ,
2765- onChanged: (double value) {
2766- setState (() {
2767- sliderValue = value;
2768- });
2769- },
2768+ child: SliderTheme (
2769+ data: SliderTheme .of (context).copyWith (
2770+ valueIndicatorShape: sliderComponentShape,
2771+ ),
2772+ child: Slider (
2773+ value: sliderValue,
2774+ max: 100 ,
2775+ label: sliderValue > 50 ? null : sliderValue.toString (),
2776+ divisions: 10 ,
2777+ onChanged: (double value) {
2778+ setState (() {
2779+ sliderValue = value;
2780+ });
2781+ },
2782+ ),
27702783 ),
27712784 );
27722785 },
0 commit comments