其他分享
首页 > 其他分享> > Flutter IconButton的padding调小无效

Flutter IconButton的padding调小无效

作者:互联网

转载:Padding调小解决方案

IconButton中padding的默认值是8.0。因为IconButton遵守Material Design设计规则,需要将边距的最小值设置为48px,所以无法调小padding。

const IconButton({
    Key? key,
    this.iconSize = 24.0,
    this.visualDensity,
    this.padding = const EdgeInsets.all(8.0),
    this.alignment = Alignment.center,
    this.splashRadius,
    ......

}

调小的解决方案:

方案1、

Container(
  padding: const EdgeInsets.all(0.0),
  width: 30.0, // you can adjust the width as you need
  child: IconButton(
  ),
),

方案2、

GestureDetector( onTap: () {}, child: Icon(Icons.volume_up) ) 

 

标签:8.0,const,IconButton,padding,width,调小,Flutter
来源: https://blog.csdn.net/weixin_43298955/article/details/115720294