FlutterSlider constructor
FlutterSlider({
- Key? key,
- double? min,
- double? max,
- required List<
double> values, - List<
FlutterSliderFixedValue> ? fixedValues, - Axis axis = Axis.horizontal,
- FlutterSliderHandler? handler,
- FlutterSliderHandler? rightHandler,
- double? handlerHeight,
- double? handlerWidth,
- dynamic onDragStarted(
- int handlerIndex,
- dynamic lowerValue,
- dynamic upperValue
- dynamic onDragCompleted(
- int handlerIndex,
- dynamic lowerValue,
- dynamic upperValue
- dynamic onDragging(
- int handlerIndex,
- dynamic lowerValue,
- dynamic upperValue
- bool rangeSlider = false,
- bool rtl = false,
- bool jump = false,
- List<
FlutterSliderIgnoreSteps> ignoreSteps = const [], - bool disabled = false,
- double? touchSize,
- bool visibleTouchArea = false,
- double minimumDistance = 0,
- double maximumDistance = 0,
- FlutterSliderTooltip? tooltip,
- FlutterSliderTrackBar trackBar = const FlutterSliderTrackBar(),
- FlutterSliderHandlerAnimation handlerAnimation = const FlutterSliderHandlerAnimation(),
- bool selectByTap = true,
- FlutterSliderStep step = const FlutterSliderStep(),
- FlutterSliderHatchMark? hatchMark,
- bool centeredOrigin = false,
- bool lockHandlers = false,
- double? lockDistance,
- BoxDecoration? decoration,
- BoxDecoration? foregroundDecoration,
Implementation
FlutterSlider(
{this.key,
this.min,
this.max,
required this.values,
this.fixedValues,
this.axis = Axis.horizontal,
this.handler,
this.rightHandler,
this.handlerHeight,
this.handlerWidth,
this.onDragStarted,
this.onDragCompleted,
this.onDragging,
this.rangeSlider = false,
this.rtl = false,
this.jump = false,
this.ignoreSteps = const [],
this.disabled = false,
this.touchSize,
this.visibleTouchArea = false,
this.minimumDistance = 0,
this.maximumDistance = 0,
this.tooltip,
this.trackBar = const FlutterSliderTrackBar(),
this.handlerAnimation = const FlutterSliderHandlerAnimation(),
this.selectByTap = true,
this.step = const FlutterSliderStep(),
this.hatchMark,
this.centeredOrigin = false,
this.lockHandlers = false,
this.lockDistance,
this.decoration,
this.foregroundDecoration})
: assert(touchSize == null || (touchSize >= 5 && touchSize <= 50)),
assert((ignoreSteps.length > 0 && step.rangeList == null) ||
(ignoreSteps.length == 0)),
assert((step.rangeList != null &&
minimumDistance == 0 &&
maximumDistance == 0) ||
(minimumDistance > 0 && step.rangeList == null) ||
(maximumDistance > 0 && step.rangeList == null) ||
(step.rangeList == null)),
assert(centeredOrigin == false ||
(centeredOrigin == true &&
rangeSlider == false &&
lockHandlers == false &&
minimumDistance == 0 &&
maximumDistance == 0)),
assert(lockHandlers == false ||
(centeredOrigin == false &&
(ignoreSteps.length == 0) &&
(fixedValues == null || fixedValues.length == 0) &&
rangeSlider == true &&
values.length > 1 &&
lockHandlers == true &&
lockDistance != null &&
step.rangeList == null &&
lockDistance >=
step.step /* && values[1] - values[0] == lockDistance*/)),
assert(
fixedValues != null || (min != null && max != null && min <= max),
"Min and Max are required if fixedValues is null"),
assert(
rangeSlider == false || (rangeSlider == true && values.length > 1),
"Range slider needs two values"),
// assert( fixedValues == null || (fixedValues != null && values[0] >= 0 && values[0] <= 100), "When using fixedValues, you should set values within the range of fixedValues" ),
// assert( fixedValues == null || (fixedValues != null && values.length > 1 && values[1] >= values[0] && values[1] <= 100), "When using fixedValues, you should set values within the range of fixedValues" ),
super(key: key);