dart 如何在AssetImage中增加图像的大小?

d7v8vwbk  于 2023-07-31  发布在  其他
关注(0)|答案(1)|浏览(133)

我正在创建一个导航栏,我已经把不同的图像作为图标在这里,我如何在这里增加图像大小.图像是存在于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);
                            }),
                      ],
                    ),
              )

字符串

f0ofjuux

f0ofjuux1#

使用Transform将图标按钮包裹起来。

Transform.scale(
  scale: 2.5,
  child: IconButton(
     icon: ImageIcon(AssetImage('assets/about.png'), size: 50,),
    onPressed: null
))

字符串

相关问题