美文网首页
2020-05-12 Flutter ListTile笔记

2020-05-12 Flutter ListTile笔记

作者: rub1cky | 来源:发表于2020-05-12 21:27 被阅读0次

构造函数

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

截屏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),
    );
  }
}

相关文章

网友评论

      本文标题:2020-05-12 Flutter ListTile笔记

      本文链接:https://www.haomeiwen.com/subject/xgoinhtx.html