如何在Flutter中删除ListView高亮颜色? [英] How to remove ListView highlight color in Flutter?

查看:396
本文介绍了如何在Flutter中删除ListView高亮颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的应用程序中实现列表视图,但是列表视图突出显示的颜色不适合我的应用程序,因此我需要将其隐藏或删除,但找不到解决方法.

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.

推荐答案

请改用如何删除滚动发光?中的解决方案.

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

尽管此处显示的解决方案有效,但实际上并不能去除.它取消了.由于创建发光效果的资源仍然存在,因此优化程度较低.而且自定义程度较低,因为它不允许用其他效果(例如淡入淡出)替换Glow.

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).

您可以在小部件树中插入NotificationListener<OverscrollIndicatorNotification>

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

,然后调用通知overscrollIndicatorNotification.disallowGlow()

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

您可以在任意位置插入NotificationListener.只要它是MaterialApp的子代且在所需的ListView以上.不必是该ListView的直接父代.

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.

这篇关于如何在Flutter中删除ListView高亮颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆