Search code examples
flutterdartmouseeventlistenerflutter-pageview

PageController ignores Listener


I'm trying to change page in a PageView when the mouse scrolls,

I'm using a Listener following this article,

in my implementation (https://dartpad.dartlang.org/c2b24881927981575ff81367121f4e5f)

using the fabs it behave as expected:

  • move to the new page
  • print the new page number
  • then prints either next or previous page

but the callback in the Listener behave weirdly :

  • print the message from the callback
  • does NOT move to a new page
  • but then prints either next or previous page

I'm not sure what is the cause of this behavior, any idea? Thank you


Solution

  • set physics property of PageView

    physics: NeverScrollableScrollPhysics()
    

    so the PageView ignores the pointer, use the feedback picked up by Listener move to pages