在 Flutter 中更改 AppBar 后退图标大小

Change AppBar back icon size in Flutter

这是当前的 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 的当前大小属性未进行任何更改。

试试这个你需要使用leading

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

示例代码

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

输出

您可以使用 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,
)),

希望这能回答您的问题。