Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove ListView highlight color in Flutter? [duplicate]

Tags:

flutter

I am implementing List View in my app, but the list view highlight color does not suit my app so I need to hide it or remove it, but could not find a way to do it.

Here is an image of the app with the highlight color I want to remove. You might notice that there is a shadow effect which weirdly overlaps the highlight effect.

The red circular shape

like image 391
Musa Usman Avatar asked Jun 17 '18 19:06

Musa Usman


1 Answers

EDIT :

Prefer the solution from How to remove scroll glow? instead.

While the solution shown here works, it doesn't actually removes the glow. It cancels it. This is less optimized as resources to create glow effects are still there. And less customizable because it doesn't allow replacing Glow with a different effect (such as fade).


You can insert in your widget tree a NotificationListener<OverscrollIndicatorNotification>

and then call on notification overscrollIndicatorNotification.disallowGlow()

 NotificationListener<OverscrollIndicatorNotification>(
    onNotification: (overscroll) {
      overscroll.disallowGlow();
    },
    child: new ListView.builder(
      itemBuilder: (context, index) {
        return new ListTile(
          title: new Text("data"),
        );
      },
    ),
  ),

You can insert NotificationListener wherever you like. As long as it's a child of MaterialApp and above the desired ListView. It doesn't need to be a direct parent of that ListView.

like image 148
Rémi Rousselet Avatar answered Sep 25 '22 21:09

Rémi Rousselet