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,
- @Deprecated('Set this flag to false to opt into the 2024 slider appearance. Defaults to true. ' 'In the future, this flag will default to false. Use SliderThemeData to customize individual properties. ' 'This feature was deprecated after v3.27.0-0.1.pre.') bool? year2023,
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, @Deprecated( 'Set this flag to false to opt into the 2024 slider appearance. Defaults to true. ' 'In the future, this flag will default to false. Use SliderThemeData to customize individual properties. ' 'This feature was deprecated after v3.27.0-0.1.pre.', ) this.year2023, }) : _sliderType = _SliderType.adaptive, padding = null, 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);