【问题标题】:How can I remove spaces between Cards in ListView?如何删除 ListView 中卡片之间的空格?
【发布时间】:2021-11-23 17:06:26
【问题描述】:

我正在研究颤振,我想在 ListView 中展示一些卡片,我成功了。

然后我想摆脱卡片之间的水平空间,我搜索并找到了一些解决方案,但没有一个有效。

如何删除空格?

ListTile(
            title:Text("   Board list"),
            tileColor: Color(COLOR_PRIMARY2),
          ),
          for(Board myBoard in boardDataList)
            BoardSelector(myBoard.boardId), //a class draws card
          ],

谢谢。

【问题讨论】:

    标签: flutter dart listview card


    【解决方案1】:

    我认为您的卡片类有问题,请尝试通过添加 EdgeInsets.zero

    来删除任何填充属性

    【讨论】:

    • 我解决了!非常感谢你。
    • 很高兴为您提供帮助!
    【解决方案2】:

    我通过如下修改代码解决了这个问题:

     return Card( 
          margin : EdgeInsets.all(1.0),
          child:
          ListTile(
    

    谢谢。

    【讨论】:

      【解决方案3】:

      我想你设置了margin: EdgeInsets.zero,你参考EdgeInsets官方文档类hereEdgeInsets.zerohere希望它对你有所帮助

            Card(
                margin: EdgeInsets.zero,
                child://Your Widget
              ),
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-08-13
        • 2020-11-19
        • 2018-10-07
        • 1970-01-01
        • 2023-03-19
        • 1970-01-01
        相关资源
        最近更新 更多