簡體   English   中英

在 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當前大小屬性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,
)),

在此處輸入圖片說明

希望這能回答你的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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