SliderThemeData constructor

const SliderThemeData({@required Color activeTrackColor, @required Color inactiveTrackColor, @required Color disabledActiveTrackColor, @required Color disabledInactiveTrackColor, @required Color activeTickMarkColor, @required Color inactiveTickMarkColor, @required Color disabledActiveTickMarkColor, @required Color disabledInactiveTickMarkColor, @required Color thumbColor, @required Color disabledThumbColor, @required Color overlayColor, @required Color valueIndicatorColor, @required SliderComponentShape thumbShape, @required SliderComponentShape valueIndicatorShape, @required ShowValueIndicator showValueIndicator, @required TextStyle valueIndicatorTextStyle })

Create a SliderThemeData given a set of exact values. All the values must be specified.

This will rarely be used directly. It is used by lerp to create intermediate themes based on two themes.

The simplest way to create a SliderThemeData is to use copyWith on the one you get from SliderTheme.of, or create an entirely new one with SliderThemeData.fromPrimaryColors.

class Blissful extends StatefulWidget {
  @override
  State createState() => BlissfulState();
}

class BlissfulState extends State<Blissful> {
  double _bliss;

  @override
  Widget build(BuildContext context) {
    return SliderTheme(
      data: SliderTheme.of(context).copyWith(activeTrackColor: const Color(0xff404080)),
      child: Slider(
        onChanged: (double value) { setState(() { _bliss = value; }); },
        value: _bliss,
      ),
    );
  }
}

Implementation

const SliderThemeData({
  @required this.activeTrackColor,
  @required this.inactiveTrackColor,
  @required this.disabledActiveTrackColor,
  @required this.disabledInactiveTrackColor,
  @required this.activeTickMarkColor,
  @required this.inactiveTickMarkColor,
  @required this.disabledActiveTickMarkColor,
  @required this.disabledInactiveTickMarkColor,
  @required this.thumbColor,
  @required this.disabledThumbColor,
  @required this.overlayColor,
  @required this.valueIndicatorColor,
  @required this.thumbShape,
  @required this.valueIndicatorShape,
  @required this.showValueIndicator,
  @required this.valueIndicatorTextStyle,
})  : assert(activeTrackColor != null),
      assert(inactiveTrackColor != null),
      assert(disabledActiveTrackColor != null),
      assert(disabledInactiveTrackColor != null),
      assert(activeTickMarkColor != null),
      assert(inactiveTickMarkColor != null),
      assert(disabledActiveTickMarkColor != null),
      assert(disabledInactiveTickMarkColor != null),
      assert(thumbColor != null),
      assert(disabledThumbColor != null),
      assert(overlayColor != null),
      assert(valueIndicatorColor != null),
      assert(thumbShape != null),
      assert(valueIndicatorShape != null),
      assert(valueIndicatorTextStyle != null),
      assert(showValueIndicator != null);