Project
Hi, I was trying to build a simple list in flutter with my custom constroller and a listener. Here is the code
class Test2 extends StatefulWidget {
@override
_Test2State createState() => _Test2State();
}
class _Test2State extends State<Test2> {
ScrollController scrollController = ScrollController();
@override
void initState() {
scrollController.addListener((){
print('controller called');
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView.builder(
controller: scrollController,
itemCount: 8,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: Colors.white,
height: 50,
),
);
},
));
}
}
Problem
My code works as intented but i'm trying to detect user swipes even when there is nothing to swipe. So far, if the list overflows the screen when user swipe scroll listener is called but, when the list of items is shorter than the screen size, this does not happend. How can i force listener to always listen?
NotificationListenerinstead?