How to Remove ScrollGlow in Flutter?

· 2 min read
Remove Scroll Glow Effect In Flutter
Remove Scroll Glow Effect In Flutter

When users create Flutter Projects Flutter adds a glowing effect on ListView/GridView/… to over scrolls on android phones like below. So we will walk through how to Remove ScrollGlow in Flutter.

How to Remove ScrollGlow in Flutter??

Remove ScrollGlow

The glow effect comes from GlowingOverscrollIndicator added by ScrollBehavior.

To remove this effect, you need to specify a custom ScrollBehavior. For that, simply wrap any given part of your application into a ScrollConfiguration with the desired ScrollBehavior.

The following ScrollBehavior will remove the glow effect entirely:

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

To Remove the glow on the whole application, you can add it right under MaterialApp:

MaterialApp(
  builder: (context, child) {
    return ScrollConfiguration(
      behavior: MyBehavior(),
      child: child,
    );
  },
  home: new MyHomePage(),
);

To remove it on a specific ListView, instead, wrap only the desired ListView:

ScrollConfiguration(
  behavior: MyBehavior(),
  child: ListView(
    ...
  ),
)

You can wrap your SingleChildScrollView or ListView.

NotificationListener<OverscrollIndicatorNotification>(
  onNotification: (OverscrollIndicatorNotification overscroll) {
    overscroll.disallowGlow();
    return;
  },
  child: SingleChildScrollView()
)

Conclusion:

So in this article, we have learned How to Remove ScrollGlow in Flutter.

Thanks for being with us on a Flutter Journey!!!
Keep Fluttering.

Do let us know if you need any assistance with Flutter Development?

FlutterAgency.com is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget GuideFlutter ProjectsCode libs and etc.

FlutterAgency.com is one of the most popular online portal dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.

Leave a Reply