CupertinoSlider constructor

const CupertinoSlider(
  1. {Key? key,
  2. required double value,
  3. required ValueChanged<double>? onChanged,
  4. ValueChanged<double>? onChangeStart,
  5. ValueChanged<double>? onChangeEnd,
  6. double min = 0.0,
  7. double max = 1.0,
  8. int? divisions,
  9. Color? activeColor,
  10. Color thumbColor = CupertinoColors.white}
)

Creates an iOS-style slider.

The slider itself does not maintain any state. Instead, when the state of the slider changes, the widget calls the onChanged callback. Most widgets that use a slider will listen for the onChanged callback and rebuild the slider with a new value to update the visual appearance of the slider.

  • value determines currently selected value for this slider.
  • onChanged is called when the user selects a new value for the slider.
  • onChangeStart is called when the user starts to select a new value for the slider.
  • onChangeEnd is called when the user is done selecting a new value for the slider.

Implementation

const CupertinoSlider({
  super.key,
  required this.value,
  required this.onChanged,
  this.onChangeStart,
  this.onChangeEnd,
  this.min = 0.0,
  this.max = 1.0,
  this.divisions,
  this.activeColor,
  this.thumbColor = CupertinoColors.white,
}) : assert(value >= min && value <= max),
     assert(divisions == null || divisions > 0);