Flutter之ListTile组件
2018-12-03 本文已影响58人
习惯了_就好
/**
const ListTile({
Key key,
this.leading,//左侧widget
this.title,//标题
this.subtitle,//副标题
this.trailing,//右侧widget
this.isThreeLine = false,//是否默认3行高度,subtitle不为空时才能使用
this.dense,//设置为true后字体变小
this.contentPadding,
this.enabled = true,//能否被点击
this.onTap,
this.onLongPress,
this.selected = false,//展开是否默认显示选中
})
*/
body: Container(
child: Center(
child: ListView(
children: <Widget>[
Container(
color: Color(0xfff1f1f1),
child: ListTile(
title: Text("Title1"),
subtitle: Text(
"Title1 subtitleTitle1 subtitleTitle1 "),
isThreeLine: true,
leading: CircleAvatar(
child: Icon(Icons.home),
),
dense: true,
onTap: () => print("Title1"),
),
),
ListTile(
title: Text("Title2"),
leading: CircleAvatar(
child: Icon(Icons.alarm),
),
selected: true,
trailing: Icon(Icons.add),
onTap: () => print("Title2"),
dense: false,
),
ListTile(
title: Text(
"Title3Title3Title3Title3Title3Title3Title3Title3Title3Title3Title3"),
leading: CircleAvatar(
child: Icon(Icons.add),
),
onTap: () => print("Title3"),
enabled: false,
),
],
),
)
),