flutter_xlider icon indicating copy to clipboard operation
flutter_xlider copied to clipboard

Support defining the value of the slider

Open ThinkDigitalSoftware opened this issue 4 years ago • 6 comments

With a Slider, we're required to supply a value. This allows us to start at any point in the slider. I wasn't able to find that property with this widget. Can that be added?

ThinkDigitalSoftware avatar Jun 08 '20 21:06 ThinkDigitalSoftware

Hi. Sorry, I didn’t quite understand what you mean. Could you provide more details? Thanks

Ali-Azmoud avatar Jun 10 '20 12:06 Ali-Azmoud

If you look at the constructor for a Slider you'll see a value property... Oh, wait. Is that what values is for? But it's a list because it might need to be a range slider?

ThinkDigitalSoftware avatar Jun 10 '20 16:06 ThinkDigitalSoftware

Yes, values with a single value is what you want.

Ali-Azmoud avatar Jun 11 '20 00:06 Ali-Azmoud

Got it. Thanks. Could you look into splitting this into 2 widgets? That way we can move all the parameters that don't make sense for a single slider out into a new class

ThinkDigitalSoftware avatar Jun 11 '20 00:06 ThinkDigitalSoftware

Also, if values is of type List<double>, then why are the function definitions for the dragging using dynamic? Sometimes it puts out an integer and sometimes it puts out an empty String

final Function(int handlerIndex, dynamic lowerValue, dynamic upperValue)
      onDragStarted;
  final Function(int handlerIndex, dynamic lowerValue, dynamic upperValue)
      onDragCompleted;
  final Function(int handlerIndex, dynamic lowerValue, dynamic upperValue)
      onDragging;

ThinkDigitalSoftware avatar Jun 11 '20 00:06 ThinkDigitalSoftware

because slider only works with double numbers but you may have custom values in output. For example take a look at fixed values section in the docs. The output can be anything.

Ali-Azmoud avatar Jun 11 '20 08:06 Ali-Azmoud