FlutterSlider constructor

FlutterSlider({
  1. Key? key,
  2. double? min,
  3. double? max,
  4. required List<double> values,
  5. List<FlutterSliderFixedValue>? fixedValues,
  6. Axis axis = Axis.horizontal,
  7. FlutterSliderHandler? handler,
  8. FlutterSliderHandler? rightHandler,
  9. double? handlerHeight,
  10. double? handlerWidth,
  11. dynamic onDragStarted(
    1. int handlerIndex,
    2. dynamic lowerValue,
    3. dynamic upperValue
    )?,
  12. dynamic onDragCompleted(
    1. int handlerIndex,
    2. dynamic lowerValue,
    3. dynamic upperValue
    )?,
  13. dynamic onDragging(
    1. int handlerIndex,
    2. dynamic lowerValue,
    3. dynamic upperValue
    )?,
  14. bool rangeSlider = false,
  15. bool rtl = false,
  16. bool jump = false,
  17. List<FlutterSliderIgnoreSteps> ignoreSteps = const [],
  18. bool disabled = false,
  19. double? touchSize,
  20. bool visibleTouchArea = false,
  21. double minimumDistance = 0,
  22. double maximumDistance = 0,
  23. FlutterSliderTooltip? tooltip,
  24. FlutterSliderTrackBar trackBar = const FlutterSliderTrackBar(),
  25. FlutterSliderHandlerAnimation handlerAnimation = const FlutterSliderHandlerAnimation(),
  26. bool selectByTap = true,
  27. FlutterSliderStep step = const FlutterSliderStep(),
  28. FlutterSliderHatchMark? hatchMark,
  29. bool centeredOrigin = false,
  30. bool lockHandlers = false,
  31. double? lockDistance,
  32. BoxDecoration? decoration,
  33. 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);