SliderThemeData constructor Null safety

const SliderThemeData(
  1. {double? trackHeight,
  2. Color? activeTrackColor,
  3. Color? inactiveTrackColor,
  4. Color? disabledActiveTrackColor,
  5. Color? disabledInactiveTrackColor,
  6. Color? activeTickMarkColor,
  7. Color? inactiveTickMarkColor,
  8. Color? disabledActiveTickMarkColor,
  9. Color? disabledInactiveTickMarkColor,
  10. Color? thumbColor,
  11. Color? overlappingShapeStrokeColor,
  12. Color? disabledThumbColor,
  13. Color? overlayColor,
  14. Color? valueIndicatorColor,
  15. SliderComponentShape? overlayShape,
  16. SliderTickMarkShape? tickMarkShape,
  17. SliderComponentShape? thumbShape,
  18. SliderTrackShape? trackShape,
  19. SliderComponentShape? valueIndicatorShape,
  20. RangeSliderTickMarkShape? rangeTickMarkShape,
  21. RangeSliderThumbShape? rangeThumbShape,
  22. RangeSliderTrackShape? rangeTrackShape,
  23. RangeSliderValueIndicatorShape? rangeValueIndicatorShape,
  24. ShowValueIndicator? showValueIndicator,
  25. TextStyle? valueIndicatorTextStyle,
  26. double? minThumbSeparation,
  27. RangeThumbSelector? thumbSelector}
)

Create a SliderThemeData given a set of exact values.

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 {
  const Blissful({Key? key}) : super(key: key);

  @override
  State createState() => BlissfulState();
}

class BlissfulState extends State<Blissful> {
  double _bliss = 0;

  @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({
  this.trackHeight,
  this.activeTrackColor,
  this.inactiveTrackColor,
  this.disabledActiveTrackColor,
  this.disabledInactiveTrackColor,
  this.activeTickMarkColor,
  this.inactiveTickMarkColor,
  this.disabledActiveTickMarkColor,
  this.disabledInactiveTickMarkColor,
  this.thumbColor,
  this.overlappingShapeStrokeColor,
  this.disabledThumbColor,
  this.overlayColor,
  this.valueIndicatorColor,
  this.overlayShape,
  this.tickMarkShape,
  this.thumbShape,
  this.trackShape,
  this.valueIndicatorShape,
  this.rangeTickMarkShape,
  this.rangeThumbShape,
  this.rangeTrackShape,
  this.rangeValueIndicatorShape,
  this.showValueIndicator,
  this.valueIndicatorTextStyle,
  this.minThumbSeparation,
  this.thumbSelector,
});