首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ListTile中的图像

ListTile中的图像
EN

Stack Overflow用户
提问于 2020-04-22 04:10:57
回答 1查看 674关注 0票数 0

如何向列表中添加高度等于列表的全高、宽度等于列表的宽度(例如200 )的照片?

代码语言:javascript
复制
    Card(
      child: ListTile(
        leading: ConstrainedBox(
            constraints: BoxConstraints(
             minWidth: 80,
             minHeight: 80,
             ),
        child: Image.network('https://d-pt.ppstatic.pl/k/r/1/59/d4/5cb1dbc30ec6d_p.jpg?1555262447', width: 120, height: 120),),
        title: Text('Three-line ListTile'),
        subtitle: Text(
          'A sufficiently long subtitle warrants three lines.'
        ),
        trailing: Icon(Icons.more_vert),
        isThreeLine: true,
      ),
    ),
EN

回答 1

Stack Overflow用户

发布于 2020-04-22 04:43:42

你可以这样做:

代码语言:javascript
复制
Card(
    child: Row(
      children: <Widget>[
        Expanded(
          flex: 1,
          child: Image.network(
            'https://d-pt.ppstatic.pl/k/r/1/59/d4/5cb1dbc30ec6d_p.jpg?1555262447',
          ),
        ),
        Expanded(
          flex: 2,
          child: ListTile(
            title: Text('Three-line ListTile'),
            subtitle:
                Text('A sufficiently long subtitle warrants three lines.'),
            trailing: Icon(Icons.more_vert),
            isThreeLine: true,
          ),
        ),
      ],
    ),
  ),

然后根据flex属性调整图像的大小。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61352342

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档