dart - How to change background color of ListTile?
问题描述
I am make settings page and want make like iOS settings (grey background and white tile). I am try add Container so can add color to ListTile but always get error.
Anyone know how to add Container here?
body: new SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Column(
children: <Widget>[
ListTile(
leading: Icon(
Icons.person,
color: Colors.grey,
),
title: Text("Account"),
trailing: Icon(Icons.keyboard_arrow_right),
),
解决方案
把你包ListTile
在一个Container
Container(
color: Colors.grey[200],
child: ListTile(
leading: Icon(
Icons.person,
color: Colors.grey,
),
title: Text("Account"),
trailing: Icon(Icons.keyboard_arrow_right),
),
)
推荐阅读
- python - 全局变量未更新
- css - 如何自动保存主 scss 文件?
- python-3.x - Matplotlib 中轴标签的格式
- java - 构建一个代表 BitSet 的板并将其存储在 BigInteger 中
- python - 用于解析尺寸测量描述的正则表达式
- angular - 角度服务是否可以从异步上下文中访问?
- javascript - 我的无序列表是从 json 文件呈现的,但我想要每个列表元素周围的边框
- jquery - 使用 Bootstrap-slider 插件在 Tooltip 中格式化数字
- javascript - 如何在不使用背景色的情况下用颜色填充 div?
- javascript - 在 Python 中使用带有 for 循环的 Asyncio,类似于 Javascript 中的 map 方法和 promise.all