[英]How to increase the size of image in AssetImage here in flutter?
我正在创建一个导航栏,我在这里放了不同的图像作为图标,如何在这里增加图像大小。图像存在于 ImageIcon 内的 Assetimage 中。当我尝试使用 ImageIcon 中的大小增加图像大小时,它不起作用.
Container(
width: size.width,
height: 80,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
icon: ImageIcon(
AssetImage(
'assets/about.png',
),
color:
currentIndex == 0 ? Colors.blue : Colors.black,
),
onPressed: () {
setBottomBarIndex(0);
},
splashColor: Colors.white,
),
IconButton(
icon: ImageIcon(
AssetImage('assets/skills.png'),
color: currentIndex == 1
? Colors.blue
: Colors.black,
),
onPressed: () {
setBottomBarIndex(1);
}),
Container(
width: size.width * 0.20,
),
IconButton(
icon: ImageIcon(
AssetImage('assets/projects.png'),
color: currentIndex == 2
? Colors.blue
: Colors.black,
),
onPressed: () {
setBottomBarIndex(2);
}),
IconButton(
icon: ImageIcon(
AssetImage('assets/blog.png'),
color: currentIndex == 3
? Colors.blue
: Colors.black,
),
onPressed: () {
setBottomBarIndex(3);
}),
],
),
)
用 Transform.scale 包裹你的图标按钮:
Transform.scale(scale: 2.5,child: IconButton(icon: ImageIcon(AssetImage('assets/about.png'), size: 50,), onPressed: null)),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.