SliderTheme(
data: SliderThemeData(
//拖条的高度
trackHeight: widget.trackHeight,
//已拖动的颜色
activeTrackColor: widget.sliderBackground == null ? Colors.blue : Colors.transparent,
//未拖动的颜色
inactiveTrackColor: widget.sliderBackground == null ? Color(0xfff5f6f7) : Colors.transparent,
//步进分割点颜色
//拖动过的部分
activeTickMarkColor: Colors.transparent,
//未拖动的部分
inactiveTickMarkColor: Colors.transparent,
//提示进度的气泡的背景色
valueIndicatorColor: Colors.green,
//提示进度的气泡文本的颜色
valueIndicatorTextStyle: TextStyle(
color:Colors.white,
),
//滑块拖拽时外圈的颜色
overlayColor: widget.thumbBorderColor ?? Colors.grey[300],
overlayShape: RoundSliderOverlayShape(
//滑块外圈大小
overlayRadius: thumbRadius + widget.thumbBorderWidth,
),
//滑块的颜色
thumbColor: widget.thumbColor ?? Colors.white,
thumbShape: RoundSliderThumbShape(
//禁用是滑块大小
disabledThumbRadius: widget.trackHeight > 10 ? thumbRadius : 11,
//滑块大小
enabledThumbRadius: widget.trackHeight > 10 ? thumbRadius : 11,
),
),
child: Slider(
min: transValue(widget.min, true),
max: transValue(widget.max, true),
value: transValue(_value, true),
onChanged: (double value) {
onSliderValue(value, false);
},
onChangeEnd: (double value) {
onSliderValue(value, true);
},
)
)