如何在flutter中删除SizedBox的默认填充

sz81bmfz  于 2023-06-30  发布在  Flutter
关注(0)|答案(1)|浏览(122)

我该如何删除SizedBox小部件中 Package 每个按钮的填充:

正如您在代码中看到的,我尝试将由SizedBox Package 的容器的填充设置为0,但没有成功。我基本上只是想让每个SizedBox变小,这样里面的内容就更接近彼此了。我想知道是否有任何变通办法这样做。

Container( // container holding the main setting buttons
  child: Padding(
    padding: const EdgeInsets.only(top: 20, bottom: 0, left: 30, right: 30),
    child: Container(
      width: double.infinity,
      decoration: BoxDecoration(
        border: Border.all(color: Colors.black, width: 2.5),
        borderRadius: BorderRadius.circular(25)
      ),
      padding: const EdgeInsets.only(left: 7, top: 7, right: 10, bottom: 8),
      child: Column(
        children: [
          Material(color: Colors.transparent,
            child: SizedBox(width: 250.0, child: Container(padding: EdgeInsets.zero, child: ListTile(onTap:(){}, title:Text("Privacy"),leading: Icon(Icons.add_circle_outline)))),
          ),
          Material(
            child: SizedBox(width: 250.0, child: ListTile(onTap:(){},title:Text("Terms of Service"),leading: Icon(Icons.add_circle_outline))),
          ),
          Material(
            child: SizedBox(width: 250.0, child: ListTile(onTap:(){},title:Text("Community Rules"),leading: Icon(Icons.add_circle_outline))),
          ),
        ]
      ),
    ),
  ),
),
oxiaedzo

oxiaedzo1#

问题与您的SizedBox无关,它属于ListTile
关于ListTile,您可以查看How to Remove space at top and bottom ListTile flutter?Remove padding from ListTile between leading and title
Icon(Icons.abcxyz)也可能包含一点空白,因为他们的设计,你也应该注意到。

相关问题