leylekseven
leylekseven

Reputation: 789

how can I detect the scroll option is not active for listview?

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

Upvotes: 0

Views: 268

Answers (2)

Ruchit
Ruchit

Reputation: 2700

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

Upvotes: 1

Hichem Benali
Hichem Benali

Reputation: 411

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?

Upvotes: 1

Related Questions