flutter_xlider icon indicating copy to clipboard operation
flutter_xlider copied to clipboard

Enhancement: Allow configuration for a stream of values, and maintaining drag position in tooltip display on steam update to values

Open Tabaka opened this issue 5 years ago • 0 comments
trafficstars

I was able to get around this issue by creating a bool and a double in a wrapper widget which tracks "isDragInProgress" and "toolTipValue" respectively. I set toolTipValue to the value provided in the custom: (value) {} in the toolTip: FlutterSliderToolTip widget, and then provide toolTipValue in the values: [ ] list as long as isDragInProgress is true (which is set true in onDragStarted, and false in onDragCompleted) otherwise I use the value provided in my stream of seconds within the values: [ ] list. It works for my needs, but it seems to be a bit kludgy to me.

Since this is for my special case, and I can work around this in a way that appears to have no performance or functionality impacts, this is super not a high priority. Just figured I'd share in case you wanted to make this a more in-built.

Here's the breakdown: I have a process that builds the slider and updates the "values: [ ]" attribute every second (like a play tracking bar). This is happening in a StreamBuilder, and as I'm dragging the slider to a new position, when the stream updates the values: [ ] list, then whatever new value is set by the stream is displayed in place of the selected value the Tooltip during the drag action. This makes the tooltip not very useful for my use case (having another process update the value in real time, and letting users seek to a new one using the tooltip as a guide). Note that the drag position still displays as I need it to, so it's not jumping (observably) back and forth or anything like that.

For instance, if I'm at the 5 second mark, and I press on the 25 second mark, when my process updates to 6 seconds, even though I'm still pressing on 25 seconds (and the slider color is at 25 seconds correctly), the tooltip displays 6 seconds, and then 7 seconds, and then 8, unless I move the tooltip, and then, for less than a second displays the expected selected value where I've dragged to... until of course 9 seconds comes along.

Anyways, not a huge deal, just figured you might like to know what people are using your package for. It's checking all the boxes for everything else I've needed, so great job. It's been a huge time saver for me. I have my feature fully implemented with the exact look and feel I had planned in one day thanks to you.

Tabaka avatar Aug 01 '20 02:08 Tabaka