颤振滑块颜色

时间:2020-07-25 19:35:15

标签: flutter flutter-slider

当不活动时,如何更改滑块圆形图标的颜色?当它进行时,我可以看到属性来更改它,但是当我按下停止歌曲并且它恢复正常时,它变为灰色。我没有在任何地方设置灰色,不确定如何更改该颜色。我已经附上了它停止播放和播放歌曲时的屏幕截图。

 Widget slider1() {
    return SliderTheme(
      data: SliderTheme.of(context).copyWith(
        activeTrackColor: Colors.red[700],
        inactiveTrackColor: Colors.red[100],
        trackShape: RoundedRectSliderTrackShape(),
        trackHeight: 2.0,
        thumbShape: RoundSliderThumbShape(enabledThumbRadius: 12.0),
        thumbColor: Colors.redAccent,
        overlayColor: Colors.red.withAlpha(32),
        overlayShape: RoundSliderOverlayShape(overlayRadius: 18.0),
        tickMarkShape: RoundSliderTickMarkShape(),
        activeTickMarkColor: Colors.red[700],
        inactiveTickMarkColor: Colors.red[100],
        valueIndicatorShape: PaddleSliderValueIndicatorShape(),
        valueIndicatorColor: Colors.redAccent,
        valueIndicatorTextStyle: TextStyle(
          color: Colors.white,
        ),
      ),
      child: Slider(
          activeColor: Colors.red.withAlpha(64),
          inactiveColor: Colors.red[200],
          label: duration.inSeconds.toString(),
          min: 0.0,
          divisions: 10,
          max: (position.inSeconds ?? 0.0).toDouble(),
          value: (getSleepkerPosition(position.inSeconds, duration.inSeconds))
              .toDouble(),
          onChangeStart: (double value) {
            print('Start value is ' + value.toString());
          },
          onChangeEnd: (double value) {
            print('Finish value is ' + value.toString());
          },
          onChanged: (double value) {
            setState(() {
              if (value == position.inSeconds) {
              } else {
                seekToSecond(value.toInt());
                value = value;
              }
            });
          }),
    );
  }

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

我找到了该属性,不知何故,它没有在颤动细节中提及,但要更改我们必须使用的禁用拇指颜色。

disabledThumbColor: Colors.amber