Mike Kokadii
Mike Kokadii

Reputation: 523

ClampingScrollPhysics when setted NeverScrollableScrollPhysics

I have made PageView, set physics to NeverScrollableScrollPhysics to disabled scroll and implements it by buttons. But when I call controller.animateToPage(/* ... */), my PageView animated with scroll glow. How to disabled this behaviour? Or this is bug of Flutter itself?

Upvotes: 1

Views: 940

Answers (1)

Tayo.dev
Tayo.dev

Reputation: 1666

To disable Scroll glow, create a class that extends ScrollBehavior

class DisableScrollGlowBehavior extends ScrollBehavior {
  @override
  Widget buildViewportChrome(
      BuildContext context, Widget child, AxisDirection axisDirection) {
    return child;
  }
}

Then wrap your scrollable List widget with ScrollConfiguration widget using the behavior of the class created.

ScrollConfiguration(
   behavior: DisableScrollGlowBehavior(),
   child: ListView(
            children: [],
   ),
)

Upvotes: 1

Related Questions