BlackHole icon indicating copy to clipboard operation
BlackHole copied to clipboard

Implementing autoscroll feature

Open BrightDV opened this issue 2 years ago • 4 comments

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.

BrightDV avatar Mar 30 '22 16:03 BrightDV

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?

BrightDV avatar Apr 15 '22 17:04 BrightDV

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.

Sangwan5688 avatar Apr 16 '22 04:04 Sangwan5688

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.

BrightDV avatar Apr 16 '22 12:04 BrightDV

Ok, I will have to check it then.

Sangwan5688 avatar Apr 20 '22 07:04 Sangwan5688

~~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.

BrightDV avatar Nov 03 '22 11:11 BrightDV

That much is fine ig. You can look for the fix later on in another PR

Sangwan5688 avatar Nov 05 '22 05:11 Sangwan5688

LGTM

Sangwan5688 avatar Nov 06 '22 03:11 Sangwan5688