如何更改Flitter中ListView的发光效果的 colored颜色 ?

Glow effect

推荐答案

在这里阅读GlowingOverscrollIndicator似乎可以更改ThemeData.accentColor的值来更改上卷发光 colored颜色 .

您可以try 使用类似的命令,将Theme的更改限制为仅ListView

//store the current Theme to restore it later
final ThemeData defaultTheme = Theme.of(context);

Theme(
  //Inherit the current Theme and override only the accentColor property
  data: Theme.of(context).copyWith(
    accentColor: Colors.yellow
  ),
  child: ListView.builder(
      //suppose data it's an array of strings
      itemBuilder: (BuildContext context, int index) =>
          EntryItem(data[index], defaultTheme),
      itemCount: data.length,
  ),
);

//this is your class to render rows
class EntryItem extends StatelessWidget {
  const EntryItem(this.entry, this.defaultTheme);

  final String entry;
  final ThemeData defaultTheme;

  Widget _buildTiles(String entry) {
    return Theme(
      data: defaultTheme,
      child: Text(entry)
    );
  }

  @override
  Widget build(BuildContext context) {
    return _buildTiles(entry);
  }
}

你可以阅读更多关于如何设计你的Theme here

Flutter相关问答推荐

使用Flutter,使用Photoshop下载的二进制文件(wav)发生意外转换

如何在抖动中将PNG图像转换为WebP

从.gitignore中排除.fvm/fvm_config.json

BaseInputfield和Textfield有什么不同?

请求已在 flutter 中发送到 django 服务器,并且已返回响应,但条件仍然为 false

如何在flutter中更改showModalBottomSheet小部件中CheckboxListTile小部件的值?

Flutter中不使用Container是否可以做margin

Flutter 使用扩展的 TextField 定位小部件

在允许屏幕 Select 和点击的同时保持通用对话框显示

在 Flutter 中显示有关提供者通知的对话框

使用堆栈的自定义按钮

Flutter 错误:OutletListModel类型的值不能分配给List类型的变量?

底部工作表顶部的一块 Flutter

Flutter使Perspective Page View无限循环

通过点击缩略图加载全屏图像

如何扫描来自给定链接或按钮的重定向中的所有 URL?

更改文本字段Flutter 中最大字母的 colored颜色

在 flutter 中自定义 agora 视频通话 UI

将一个 Flutter 应用程序集成到另一个 Flutter 应用程序中

如何将图像网络装箱到具有边界半径的容器中