【问题标题】:Change AppBar back icon size in Flutter在 Flutter 中更改 AppBar 后退图标大小
【发布时间】:2020-04-16 15:56:00
【问题描述】:

这是当前的 AppBar 代码:

AppBar(
  iconTheme: IconThemeData(
    color: Colors.black,
    size: 100 // This isn't performing any changes
  ),
  centerTitle: false,
  backgroundColor: Colors.white,
  title: Text(
    title,
    style: TextStyle(color: Colors.black87,

  ),
  elevation: 1.0,
);

IconThemeData 的当前尺寸属性没有做任何更改。

【问题讨论】:

标签: android flutter dart flutter-appbar


【解决方案1】:

试试这个你需要使用leading

  • 在标题之前显示的小部件。

示例代码

 AppBar(
      title: new Text("Your Title"),
      leading: new IconButton(
        icon: new Icon(Icons.arrow_back,size: 50.0,),
        onPressed: () => {
          // Perform Your action here
        },
      ),
    );

输出

【讨论】:

    【解决方案2】:

    您可以使用Transform.scale 小部件并用它包装IconButton。此小部件具有 scale 属性,您可以根据需要进行设置。下面的工作示例代码:

    appBar: AppBar(
            leading: Transform.scale(
              scale: 2,
              child: IconButton(
              icon: Icon(Icons.arrow_back, color: Colors.black),
              onPressed: () {}
              )
            ),
    
      centerTitle: false,
      backgroundColor: Colors.white,
      title: Text(
        'test',
        style: TextStyle(color: Colors.black87,
    
      ),
    //  elevation: 1.0,
    )),
    

    希望这能回答你的问题。

    【讨论】:

      猜你喜欢
      • 2021-12-27
      • 1970-01-01
      • 2020-06-03
      • 1970-01-01
      • 2022-12-16
      • 2019-05-07
      • 2018-02-08
      • 1970-01-01
      • 2020-05-22
      相关资源
      最近更新 更多