如何增加AppBar抖动前导图标的大小

问题描述 投票:0回答:1

我正在寻找增加Appbar前导图标大小的方法。下面是我的代码:

appBar: PreferredSize(
              preferredSize: Size.fromHeight(120.0),
              child: AppBar(
                leading: SizedBox(
                  width: 200,
                height: 200,
                child: IconButton(
                  padding: new EdgeInsets.all(0.0),
                  icon: Image.asset('assets/app_logo.png', height: 700.0, width: 700.0,)
                  ,
                )),
            centerTitle: true,
            actions: <Widget>[
              IconButton(
                  icon: Image.asset('assets/path.png'))
            ],
            bottom: TabBar(
                labelColor: Colors.white,
                indicatorColor: Colors.lime,

                tabs:[
                  Tab(icon: null,text: 'RECENT',),
                  Tab(icon: null, text: 'TOPICS',),
                  Tab(icon: null, text: 'AUTHORS',),
                ]
            ),
          )

从上面的代码开始,具体来说,我实现的大小在下面,但是它无法工作:

child: AppBar(
                    leading: SizedBox(
                      width: 200,
                    height: 200,
                    child: IconButton(
                      padding: new EdgeInsets.all(0.0),
                      icon: Image.asset('assets/app_logo.png', height: 700.0, width: 700.0,)
                      ,
                    )),

我的目标是将“ Right top”图标增加更大,但不会增加其大小。

屏幕截图如下:

enter image description here

flutter dart appbar
1个回答
1
投票

您可以通过将IconButton换为Transform.scale并将scale的值传递为2来增加图标的大小,具体取决于您希望图标的大小。下面的工作示例代码:

centerTitle: true,
                actions: <Widget>[
                  Transform.scale(
                    scale: 2,
                    child: IconButton(
                        icon: Image.asset('assets/placeholder.png'))
                  ),

                ],

这将增加应用栏中右上角图标的大小,如下所示:

enter image description here

您可以根据需要调整比例,也可以对左上角的图标进行相同的更改。

希望这能回答您的问题。

© www.soinside.com 2019 - 2024. All rights reserved.