android - 如何在颤动中增加 AssetImage 中图像的大小?
问题描述
我正在创建一个导航栏,我在这里放置了不同的图像作为图标,如何在这里增加图像大小。图像存在于 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)),
推荐阅读
- javascript - 当用户在 react.s 中选择来自 api 的列表项时如何切换类?
- math - Perlin 噪声不同的实现
- python - scrapy python中的Unicode问题
- xamarin.forms - Xamarin 表单输入框使用自定义键盘丢失光标位置
- asp.net-core - Visual Studio 2019 Net 5 ASP.NET Core WebApp 错误 MSB3644 .NETFramework,Version=v5.0 的参考程序集未找到
- jquery - When user select 2 then two select box and input field will show and when 3 is selected then ONLY three select box and input fields is show
- javascript - 在页面加载方面是否可以加载js文件并在客户端使用js创建整个页面
- linux - 如何仅将缺少的参数添加到配置文件?
- python - 如何在 Windows 上使用来自 Python 数组的内容创建文件?
- ceph - ceph fs mds 卡在 `up:rejoin` 状态 - `未能打开 ino 0x101 err -116/0`