SliderThemeData constructor

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

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.

link
class Blissful extends StatefulWidget {
  const Blissful({super.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.secondaryActiveTrackColor,
  this.disabledActiveTrackColor,
  this.disabledInactiveTrackColor,
  this.disabledSecondaryActiveTrackColor,
  this.activeTickMarkColor,
  this.inactiveTickMarkColor,
  this.disabledActiveTickMarkColor,
  this.disabledInactiveTickMarkColor,
  this.thumbColor,
  this.overlappingShapeStrokeColor,
  this.disabledThumbColor,
  this.overlayColor,
  this.valueIndicatorColor,
  this.valueIndicatorStrokeColor,
  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,
  this.mouseCursor,
  this.allowedInteraction,
});