Flutter Listview Continuous Auto Scroll Back and Forth Using Recursion

preview_player
Показать описание


📢Remember to
Subscribe🔴, Like👍, Share↗️ this video, and Star the repo on Github⭐

📢Socials

#Flutter #Recursion
Рекомендации по теме
Комментарии
Автор

Man, Thank you so much! This helped me immensely!

Erwasen
Автор

Thanks for this great tutorial, I have a question, it's possible to pause the scroll when the user tap on List and let the user to control the list, and after user release the onTap to start tha animation again?
P.S: also how can set the list to scroll in loop continuous? Thanks and keep up the good work!

buracadorin
Автор

Hello,
Perfect. I just need to add to the same lists the ability to scroll it manually. How can I do that?

sherifsaidelahl
Автор

If you want to pause and normally access the scroll, and child widgets, you can do the following:

bool keepScrolling = true;
animateToMaxMin(double max, double min, double direction, int seconds, ScrollController scrollController) {
if (scrollController.hasClients && keepScrolling) {
scrollController
.animateTo(direction, duration: Duration(seconds: seconds), curve: Curves.linear)
.then((value) {
if (scrollController.hasClients) {
direction = direction == max ? min : max;
animateToMaxMin(max, min, direction, seconds, scrollController);
}
});
}
}


and

@override
Widget build(BuildContext context) {
return Listener(
onPointerDown: (_) {
keepScrolling = false; //add this listener
},
child: Container /// rest of the code

omkarbojjawar