gpt4 book ai didi

flutter - 如何增加 AppBar flutter 前导图标的大小

转载 作者:行者123 更新时间:2023-12-03 04:51:38 31 4
gpt4 key购买 nike

我正在寻找一种增加 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,)
,
)),

我的目标是将右上角图标增加得更大,但不会增加它的大小。

截图如下:

enter image description here

最佳答案

您可以通过使用 Transform.scale 包装 IconButton 来增加图标的大小,并将 scale 值传递为 2,具体取决于大小你想要的图标是。下面的工作示例代码:

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

],

这会增加应用栏右上角图标的大小,如:

enter image description here

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

希望这能回答您的问题。

关于flutter - 如何增加 AppBar flutter 前导图标的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61252412/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com