Slider.adaptive constructor
- Key? key,
- required double value,
- double? secondaryTrackValue,
- required ValueChanged<
double> ? onChanged, - ValueChanged<
double> ? onChangeStart, - ValueChanged<
double> ? onChangeEnd, - double min = 0.0,
- double max = 1.0,
- int? divisions,
- String? label,
- MouseCursor? mouseCursor,
- Color? activeColor,
- Color? inactiveColor,
- Color? secondaryActiveColor,
- Color? thumbColor,
- MaterialStateProperty<
Color?> ? overlayColor, - SemanticFormatterCallback? semanticFormatterCallback,
- FocusNode? focusNode,
- bool autofocus = false,
- SliderInteraction? allowedInteraction,
Creates an adaptive Slider based on the target platform, following Material design's Cross-platform guidelines.
Creates a CupertinoSlider if the target platform is iOS or macOS, creates a Material Design slider otherwise.
If a CupertinoSlider is created, the following parameters are ignored:
secondaryTrackValue
, label
, inactiveColor
, secondaryActiveColor
,
semanticFormatterCallback
.
The target platform is based on the current Theme: ThemeData.platform.
Implementation
const Slider.adaptive({
super.key,
required this.value,
this.secondaryTrackValue,
required this.onChanged,
this.onChangeStart,
this.onChangeEnd,
this.min = 0.0,
this.max = 1.0,
this.divisions,
this.label,
this.mouseCursor,
this.activeColor,
this.inactiveColor,
this.secondaryActiveColor,
this.thumbColor,
this.overlayColor,
this.semanticFormatterCallback,
this.focusNode,
this.autofocus = false,
this.allowedInteraction,
}) : _sliderType = _SliderType.adaptive,
assert(min <= max),
assert(value >= min && value <= max,
'Value $value is not between minimum $min and maximum $max'),
assert(secondaryTrackValue == null || (secondaryTrackValue >= min && secondaryTrackValue <= max),
'SecondaryValue $secondaryTrackValue is not between $min and $max'),
assert(divisions == null || divisions > 0);