flutter_fluid_slider
flutter_fluid_slider copied to clipboard
Slider don't have smooth animation when start.
When we start the slider it takes a leap and after that it works perfectly fine.
@naveenyadav15 Sorry! I could not understand you clearly. The thumb is intended to jump. Is that what you are saying?
No, i am saying that when it is moved in right direction at. Start it doesn't move smoothly it jumps 5 values after that it works fine.
I think what @naveenyadav15 means is that there is a bit of delay between drag start and pop up and it doesn't feel smooth enough!
I think the solution is in reducing the animation time and changing the animation (this is because the distance the animation is travelling is small for bounce to look good)
I have a potential solution in mind, if you are interested?
@maddyb99 Thank you Maddy. I would really appreciate some help. You can push it forward and just submit the pull request. Or suggest the solution. I will look into it 😊
Well, I have 2 options, I will record and upload GIF for both in some time and also open a PR for the same!
I have opened PR #13 to update example and gitignore and #14 for animation
@maddyb99 Thank you for the PR. Changing the animation duration and curve gives a new feel to the slider but does not solve the issue @naveenyadav15 mentions. Now I found the issue to be that of the slider thumb jumping from value 0 to like 10 or 11 instantly. I tried it removing the thumb animation completely and this issue still persists. This is what that's. needs to be fixed.
@rvamsikrishna are you running the example app in debug mode?
When we start the slider it takes a leap and after that it works perfectly fine.
This problem does not happen in release mode. It might be because of the overhead due to the flutter VM. All animations appear to be slow at first.
Debug mode builds use a virtual machine (VM) to run Dart code (hence the “debug” banner they show to remind people that they’re slightly slower) in order to enable Stateful Hot Reload.
Source: FAQ - Flutter
I also noticed this and then tried this in release mode and it works fine.
@maddyb99 I removed the animations. The value jump is happening the value of slider.
Just to get on the same page, you are talking about this jump(in the middle bar), right?

@maddyb99 yup...that jump in the orange slider
See,
In debug mode:
Here, as you mentioned, the value jumped from 10 to 240

In release mode:
But here, we can see the thumb come up during sliding

Even if animations are removed, moving the slider can be considered as an animation in itself and flutter needs to update the state to show it onto the screen, which has a VM overhead.
This is not the case in release mode, where Dart is compiled to native binary and therefore removes the latency due to the VM.
@maddyb99 I understand all the overhead of JIT and assets that happen on debug mode. I tried running it in profile mode. To reproduce the issue create a normal Slider with min:0.0 and max:100.0. With this generic Material Slider, it is possible to move the slider from 0.0 to1.0. But this is not the case with Fluid slider. You cant go from 0.0 to 1.0. There is this jump in value.
Thank you, I really appreciate your time and effort in participating in solving the issue.
Oh, so you want steps, I guess. To which the slider aligns while moving? If I'm getting this right, then this needs more precision when sliding? I will try to reproduce it tonight. Meanwhile, if you feel like it, you can still merge this PR for removing the delayed bounce!
Yes, I am able to reproduce the jump! Will try to figure out the reason. Also, I will unlink the PR form this issue, and create a new issue for what I tried to fix :P
I am not able to find a solution to this and honestly didn't get much time in the past few days, will keep looking!
@maddyb99 I got a chance to spend some time yesterday. I cornered down the problem to be not considering the slider thumb padding and the offset of actual slider on x axis while converting the global to local.