构造函数
const ListTile({
Key key,
this.leading, //标题之前,大多数设置图标
this.title,// 标题
this.subtitle, // 副标题
this.trailing,// 后缀,一般是图标
this.isThreeLine = false,
this.dense,// 密度
this.contentPadding,
this.enabled = true, // 禁用状态
this.onTap, // 点击回调函数
this.onLongPress,// 长按回调函数
this.selected = false,// 选中状态,要配合ListTileTheme
})
Demo
![](https://img.haomeiwen.com/i9403487/de899d53bd0acfc1.png)
截屏2020-05-12 下午9.27.24.png
class DemoListTile extends StatelessWidget {
const DemoListTile();
@override
Widget build(BuildContext context) {
// TODO: implement build
return ListTile(
leading: Icon(Icons.ac_unit, color: Colors.red),
title: Text("测试标题"),
isThreeLine: true,
dense: true,
subtitle: Container(
child: Padding(padding: EdgeInsets.only(top: 20, bottom: 20), child: Text("Padding"),),
),
onTap: () {
print("点击事件");
},
trailing: Icon(Icons.accessibility_new),
);
}
}
网友评论