BlackHole
BlackHole copied to clipboard
Implementing autoscroll feature
Hello!
I have finally managed to implement the autoscroll feature in the SlidingUpPanel
. I used a ValueListenableBuilder
and utilized the gradientColor as the valueListenable
.
Now:
- When the user plays a new song, it autoscrolls if the player is open or closed, but only once.
- When the song played is one of the 3 last, it doesn't autoscroll because otherwise it was buggy and scrolled under the `List`…
- One thing is when the song played isn't the first one and coming from another screen, the
SlidingUpPanel
autoscrolls after the user moves the List
Also, there was a problem with the height of the Text
but I have added 12dp plus the index * height of a ListTile (72dp) so now this is fixed!
Besides, I don't know if an option to enable/disable it is necessary here.
But when I tried running the app, it doesn't autoscroll until unless I scroll it atleast once. It autoscrolls only after I scroll it once, otherwise not
It is what I meant in
- One thing is when the song played isn't the first one and coming from another screen, the
SlidingUpPanel
autoscrolls after the user moves the List
I have tried many ways, but it never autoscrolls by itself, I don't know if you have an idea?
I see. Umm, one thing you can do is to move that autoscroll function to audioplayer screen instead of keeping it inside upnext menu. I think the controller is being provided by audioplayer screen so you will be able to scroll it from there. Then you can just check the initial position from there and try it. Most probably it should work.
So I have tried to wrap the ClipRRect
inside a StreamBuilder
, in order to access the audioHandler.queueState
data.
However, the problem is still here, it doesn't autoscroll the first time…
I will push the commit that I made, but they don't fix the problem.
Ok, I will have to check it then.
~~I will try to reimplement it from scratch in the next days, so I have reverted my past commits.~~ For the moment, it works better. However, same problem as always, it doesn't autoscroll on start, I will have to find a workaround.
That much is fine ig. You can look for the fix later on in another PR
LGTM