我希望列表磁贴出现在背景顶部,文本看起来很好,但磁贴的 colored颜色 出现在徽标后面.

I tried putting it in a stack so it's positioned correctly on top of each other but no use, I also tried using the Positioned and Expanded widgets as suggested by BlackBox AI but nothing, I didn't find any questions online that resembles this one and I'm still a beginner so I have no idea how to troubleshoot this, here's my code so far,
EDIT: ok I had a problem with pasting the code here so heres a link to it (https://pastecode.io/s/0zop54cs)

and here's the emulator, dont mind the hideous design

推荐答案

正如a similar issue on GitHubthis comment中提到的那样,ListTile将其背景描绘在其物质祖先上.

要将tileColor绘制在背景滤镜顶部,您需要用自己的Material小部件包裹ListView小部件,并为其赋予透明 colored颜色 ,以免干扰其他样式:

Material(
  color: Colors.transparent,
  child: ListView(
    // ...
  ),
)

或者,您还可以用自己的Material小部件包裹每个ListTile.

Flutter相关问答推荐

错误:找不到字体功能类型.Ffltter Google_Fonts包错误

摆动如何更改弹出菜单项高亮显示 colored颜色 半径

如何在表格日历标题下方添加文本?

我有相关的下拉菜单Flutter Windows应用程序的问题

'Flutter的无效常数值错误

Flutter /dart 列表.第一个子类列表中的Where()错误

Flutter :执行com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction时出现故障

如何将小部件代码移动到另一个文件以获得更好的可读性

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

Riverpod 2.3.6:AutoDisposeNotifier和ref.onDispose自动处理

MediaQuery 在不同手机上不一致

通过一个具体的例子理解Flutter约束的本质

Flutter RIverpod 奇怪地改变状态

如何在椭圆形图像周围添加边框?Flutter

主题:ThemeData() Flutter

一个或多个插件需要更高的 Android SDK 版本

带图像封面的 ElevatedButton

RangeError(索引):无效值:有效值范围为空:点击文章时为0

如何将 pushNamed 与 Dismissible Widget 一起使用并查看背景透明第一页

FLUTTER+SQL:在 ListViewBuilder 中显示数据库中的数据