diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart index 34caf58781..393c7c5915 100644 --- a/packages/flutter/lib/src/material/slider_theme.dart +++ b/packages/flutter/lib/src/material/slider_theme.dart @@ -417,7 +417,7 @@ class SliderThemeData extends Diagnosticable { overlayShape: const RoundSliderOverlayShape(), tickMarkShape: const RoundSliderTickMarkShape(), thumbShape: const RoundSliderThumbShape(), - trackShape: const RectangularSliderTrackShape(), + trackShape: const RoundedRectSliderTrackShape(), valueIndicatorShape: const PaddleSliderValueIndicatorShape(), rangeTickMarkShape: const RoundRangeSliderTickMarkShape(), rangeThumbShape: const RoundRangeSliderThumbShape(), diff --git a/packages/flutter/test/material/slider_theme_test.dart b/packages/flutter/test/material/slider_theme_test.dart index 2321a6d529..fe6393d41b 100644 --- a/packages/flutter/test/material/slider_theme_test.dart +++ b/packages/flutter/test/material/slider_theme_test.dart @@ -163,6 +163,30 @@ void main() { expect(sliderTheme.valueIndicatorTextStyle.color, equals(customColor4)); }); + testWidgets('SliderThemeData generates correct shapes for fromPrimaryColors', (WidgetTester tester) async { + const Color customColor1 = Color(0xcafefeed); + const Color customColor2 = Color(0xdeadbeef); + const Color customColor3 = Color(0xdecaface); + const Color customColor4 = Color(0xfeedcafe); + + final SliderThemeData sliderTheme = SliderThemeData.fromPrimaryColors( + primaryColor: customColor1, + primaryColorDark: customColor2, + primaryColorLight: customColor3, + valueIndicatorTextStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: customColor4), + ); + + expect(sliderTheme.overlayShape, const RoundSliderOverlayShape()); + expect(sliderTheme.tickMarkShape, const RoundSliderTickMarkShape()); + expect(sliderTheme.thumbShape, const RoundSliderThumbShape()); + expect(sliderTheme.trackShape, const RoundedRectSliderTrackShape()); + expect(sliderTheme.valueIndicatorShape, const PaddleSliderValueIndicatorShape()); + expect(sliderTheme.rangeTickMarkShape, const RoundRangeSliderTickMarkShape()); + expect(sliderTheme.rangeThumbShape, const RoundRangeSliderThumbShape()); + expect(sliderTheme.rangeTrackShape, const RoundedRectRangeSliderTrackShape()); + expect(sliderTheme.rangeValueIndicatorShape, const PaddleRangeSliderValueIndicatorShape()); + }); + testWidgets('SliderThemeData lerps correctly', (WidgetTester tester) async { final SliderThemeData sliderThemeBlack = SliderThemeData.fromPrimaryColors( primaryColor: Colors.black,