I am trying to write a scroll pagination widget but What I am stuck some point due scroll controller. I am listening a scroll controller, if user scrolled the list to end of the listview I am sending a page request but it is not working because if first request response widgets height lesser than the view height, user can't scroll so scroll controller listener never triggering. For this problem, my question is how can I detect the scrolling is active or not ? (what I want is, if loaded page results widgets smaller than the list view height, send a new page request.)
Asked
Active
Viewed 91 times
2 Answers
1
you can apply AlwaysScrollableScrollPhysics()
to your gridview and it will always let the user scroll even if it has less height.
documentation: https://api.flutter.dev/flutter/widgets/AlwaysScrollableScrollPhysics-class.html

Ruchit
- 2,137
- 1
- 9
- 24
-
But I must fetch pages without interaction at the beginning, so what can I do? – leylekseven Jun 03 '22 at 02:13
-
call in `initstate` something like `scrollcontroller.animateTo()` or `getdata`. – Ruchit Jun 03 '22 at 02:47
-
But if elements height twice of the view port, than user will find himself at the end of the page so I can't do this. – leylekseven Jun 03 '22 at 05:12
1
Ruchit's answer is a good option, Or you could get the height of the widget and compare it to the screen height. That should work.
How to get the widget's height: How to get height of a Widget?

Hichem Benali
- 413
- 3
- 6