一个固定高度的行,通常包含一些文本,以及一个行前或行尾图标。

构造方法

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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,
  })

leading

最左侧的头部,参数是一个widget,(这里以icon为例)

1
 new ListTile(leading: new Icon(Icons.cake),)

示例

title

控件的title(参数是widget,这里text为例)

1
2
3
4
ListTile(
    leading: new Icon(Icons.cake),
    title: new Text('标题'),
    )

示例

subtitle

富文本标题

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ListTile(
    leading: new Icon(Icons.cake),
    title: new Text('标题'),
    subtitle: new Row(
        children: <Widget>[
        new Text('副标题'),
        new Icon(Icons.person)
        ],
    ),
    )

富文本标题

trailing

展示在title后面最末尾的后缀组件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ListTile(
    leading: new Icon(Icons.cake),
    title: new Text('标题'),
    subtitle: new Row(
        children: <Widget>[
        new Text('副标题'),
        new Icon(Icons.person)
        ],
    ),
    trailing: new Icon(Icons.save),
    )

trailing

onTap

点击事件

1
2
3
 onTap: () {
        print('点击');
    },