How can I detect continuously if scrolling is disabled in Flutter?
177
Use NotificationListener
widget.
example:
NotificationListener<ScrollNotification>(
child: ListView(
children: MyListChilren()),
onNotification: (ScrollNotification scrollNotif) {
print(scrollNotif.metrics.maxScrollExtent);
},
);
Author by
aimyon
Updated on December 01, 2022Comments
-
aimyon over 1 year
I want to constantly check if scrolling is not possible.
@override void initState() { super.initState(); WidgetsBinding.instance!.addPostFrameCallback((duration) { print("${_scrollViewController.position.maxScrollExtent}"); // prints true if scrollable else false print("isScrollable = ${_scrollViewController.position.maxScrollExtent != 0}"); }); }
I've tried this code, but it's only detected once and not continuously. What should I do?