sliderThemeData static method
SliderThemeData
sliderThemeData(
- Palette colors,
- TextTheme textTheme
)
Implementation
static SliderThemeData sliderThemeData(Palette colors, TextTheme textTheme) {
return SliderThemeData(
overlayShape: const RoundSliderOverlayShape(),
tickMarkShape: SliderTickMarkShape.noTickMark,
thumbShape: SliderFlatThumb(
borderWidth: 2,
borderColor: colors.colorBorder,
),
trackShape: SliderFlatShape(),
trackHeight: touchSize,
activeTrackColor: colors.color,
// This is a _nice_ touch: ex. if an elevated button is above this slider,
// the shadow isn't cut off
inactiveTrackColor: Colors.transparent,
secondaryActiveTrackColor: colors.color,
disabledActiveTrackColor: colors.color,
disabledInactiveTrackColor: colors.background,
disabledSecondaryActiveTrackColor: colors.color,
// Tick marks mess up SliderFlat, aka a Slider with a border.
activeTickMarkColor: Colors.transparent,
inactiveTickMarkColor: Colors.transparent,
disabledActiveTickMarkColor: Colors.transparent,
disabledInactiveTickMarkColor: Colors.transparent,
thumbColor: colors.color,
overlappingShapeStrokeColor: colors.fillText,
disabledThumbColor: colors.color,
overlayColor: Colors.transparent,
valueIndicatorColor: colors.color,
valueIndicatorShape: const DropSliderValueIndicatorShape(),
rangeTickMarkShape: const RoundRangeSliderTickMarkShape(),
rangeThumbShape: const RoundRangeSliderThumbShape(),
rangeTrackShape: const RoundedRectRangeSliderTrackShape(),
rangeValueIndicatorShape: const PaddleRangeSliderValueIndicatorShape(),
showValueIndicator: ShowValueIndicator.onDrag,
valueIndicatorTextStyle: textTheme.labelLarge!.copyWith(
color: colors.colorText,
),
minThumbSeparation: 8,
allowedInteraction: SliderInteraction.tapAndSlide,
);
}