android - 如何在颤动中设置滚动条颜色?
问题描述
我有一个ListView
由Scrollbar
类包装的法线,以在向下滚动时产生滚动条。但是我想将Scrollbar
颜色更改为白色,因为我有深色背景。
在探索Scrollbar
课程后,我可以看到它使用了highlightColor
里面所示的主题scrollbar.dart
。
_themeColor = theme.highlightColor.withOpacity(1.0);
尝试将其包裹起来Scrollbar
,Theme
但仍然没有运气。
下面是我的代码 -
Theme(
data: ThemeData(
highlightColor: Colors.white, //Does not work
),
child: Scrollbar(
child: ListView(
//Normal ListView code
),
),
)
任何帮助表示赞赏。提前致谢。
解决方案
您可以改用 RawScrollbar 并将 thumbColor 设置为您喜欢的任何颜色。
child: RawScrollbar(
thumbColor: Colors.redAccent,
radius: Radius.circular(20),
thickness: 5,
child: //scrollable widget
)
推荐阅读
- swift - 虽然当前导航然后显示视图控制器栏按钮不来,为什么在 swift
- javascript - 在我的表单按钮上调用 submit() 和 reload() 不起作用
- minecraft - 当我尝试构建我的 jar 文件(java)时,获取包 org.bukkit 不存在
- php - 在php中使用通配符更改多维数组值?
- python - 如何创建用于猪拉丁语和 izzle 翻译的代码以及同时应用它们的代码?
- azure-storage - Azure blob 存储:同一 Azure 存储帐户中跨容器的块 blob 同步副本不起作用
- javascript - 将数组拆分成块并重复前面的元素
- flutter - SingleChildScrollView 把所有东西都推上去(问题)
- html - django 查询集未显示准确结果(构建新闻应用程序)
- flutter - 有没有办法在 VS Code 上的类和方法之间添加水平标尺,比如 IntelliJ?