簡體   English   中英

如何在 flutter 中增加 AssetImage 中的圖像大小?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM