简体   繁体   English

如何调整 Flutter 中 IconButton 的大小(高度和宽度)

[英]How to resize (height and width) of an IconButton in Flutter

How to resize (height and width) of an IconButton in Flutter?如何调整 Flutter 中 IconButton 的大小(高度和宽度)? Seems like it takes a default width and height.似乎它需要默认的宽度和高度。 There is not height or width property.没有高度或宽度属性。

new IconButton(
    padding: new EdgeInsets.all(0.0),
    color: themeData.primaryColor,
    icon: new Icon(Icons.clear, size: 18.0),
    onPressed: onDelete,
)

How to resize (height and width) of an IconButton in Flutter?如何在Flutter中调整IconButton的大小(高度和宽度)? Seems like it takes a default width and height.似乎需要默认的宽度和高度。 There is not height or width property.没有height或width属性。

new IconButton(
    padding: new EdgeInsets.all(0.0),
    color: themeData.primaryColor,
    icon: new Icon(Icons.clear, size: 18.0),
    onPressed: onDelete,
)

How to resize (height and width) of an IconButton in Flutter?如何在Flutter中调整IconButton的大小(高度和宽度)? Seems like it takes a default width and height.似乎需要默认的宽度和高度。 There is not height or width property.没有height或width属性。

new IconButton(
    padding: new EdgeInsets.all(0.0),
    color: themeData.primaryColor,
    icon: new Icon(Icons.clear, size: 18.0),
    onPressed: onDelete,
)

How to resize (height and width) of an IconButton in Flutter?如何在Flutter中调整IconButton的大小(高度和宽度)? Seems like it takes a default width and height.似乎需要默认的宽度和高度。 There is not height or width property.没有height或width属性。

new IconButton(
    padding: new EdgeInsets.all(0.0),
    color: themeData.primaryColor,
    icon: new Icon(Icons.clear, size: 18.0),
    onPressed: onDelete,
)

Use IconButton > splashColor ,使用IconButton > splashColor

IconButton(
  // use this to decrease/increase the splash spacing
  splashRadius: 24.0,  // (Material.defaultSplashRadius = 35.0)
  color: buttonColor,
  icon: Icon(Icons.heart),
  onPressed: () {},
);

演示图标按钮

How to resize (height and width) of an IconButton in Flutter?如何在Flutter中调整IconButton的大小(高度和宽度)? Seems like it takes a default width and height.似乎需要默认的宽度和高度。 There is not height or width property.没有height或width属性。

new IconButton(
    padding: new EdgeInsets.all(0.0),
    color: themeData.primaryColor,
    icon: new Icon(Icons.clear, size: 18.0),
    onPressed: onDelete,
)

How to resize (height and width) of an IconButton in Flutter?如何在Flutter中调整IconButton的大小(高度和宽度)? Seems like it takes a default width and height.似乎需要默认的宽度和高度。 There is not height or width property.没有height或width属性。

new IconButton(
    padding: new EdgeInsets.all(0.0),
    color: themeData.primaryColor,
    icon: new Icon(Icons.clear, size: 18.0),
    onPressed: onDelete,
)

IconButton 的点击区域是可以感知用户交互的区域,它的最小尺寸是 kMinInteractiveDimension (48.0),与 Icon 的实际尺寸无关。

这有用了

Icon(Icons.person,color: Colors.red,size: 180.0,)

If anyone's looking to change the Splash/Hover shadow size for the icon buttons.如果有人想要更改图标按钮的 Splash/Hover 阴影大小。 You need to set splashRadius property to the desired value in the IconButton.您需要在 IconButton 中将 splashRadius 属性设置为所需的值。

IconButton(
     splashRadius: 12,
     padding: EdgeInsets.zero,
     icon: Icon(
             Icons.visibility,
              color: Theme.of(context).primaryColorDark,
    ),
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM