[Material] Fix slider track shape to rounded (#34178)
The slider track shape for the onPrimaryColors constructor should be rounded, but it was accidentally changed to rectangular in #31681. This change restores the original behavior. This only affects sliders that are themed with SliderThemeData.onPrimaryColors().
This commit is contained in:
parent
c88f64ed50
commit
0bbac72558
@ -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(),
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user