flutter控件之---------listTile

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

构造方法

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,
  })

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

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

《flutter控件之---------listTile》 leading.png

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

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

《flutter控件之---------listTile》 title.png

3.subtitle
富文本标题(参数是widget)

new ListTile(
                leading: new Icon(Icons.cake),
                title: new Text('标题'),
                subtitle: new Row(
                  children: <Widget>[
                    new Text('副标题'),
                    new Icon(Icons.person)
                  ],
                ),
              )

《flutter控件之---------listTile》 subtitle.png

4.trailing

展示在title后面最末尾的后缀组件(参数是widget)

new 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),
              )

《flutter控件之---------listTile》 trailing.png

5.onTap

点击事件

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

其他方法类型 不做介绍

    原文作者:聆听璇律
    原文地址: https://www.jianshu.com/p/c80c2b70ee09
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞