Slider.adaptive constructor Null safety
- {Key? key,
- required double value,
- 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? thumbColor,
- SemanticFormatterCallback? semanticFormatterCallback,
- FocusNode? focusNode,
- bool autofocus = false}
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: label, inactiveColor, semanticFormatterCallback.
The target platform is based on the current Theme: ThemeData.platform.
Implementation
const Slider.adaptive({
super.key,
required this.value,
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.thumbColor,
this.semanticFormatterCallback,
this.focusNode,
this.autofocus = false,
}) : _sliderType = _SliderType.adaptive,
assert(value != null),
assert(min != null),
assert(max != null),
assert(min <= max),
assert(value >= min && value <= max),
assert(divisions == null || divisions > 0);