How to remove extra padding around AppBar leading icon in Flutter

后端 未结 8 1165
陌清茗
陌清茗 2020-12-09 08:33

In my Flutter app, I have this AppBar

Widget setAppBar(){
  return new AppBar(
    title: addAppBarTextWidget(\'Explore\'),
    elevation: 0.0,
    leading:          


        
8条回答
  •  再見小時候
    2020-12-09 08:58

    If you just need to move the icon a bit to the left like I did, you can still use the leading property and just set the alignment on the IconButton:

        leading: Builder(
          builder: (BuildContext context) {
            return IconButton(
              onPressed: () => Navigator.pop(context),
              icon: MyIcon(),
              alignment: Alignment(-0.5, 0.0), // move icon a bit to the left
            );
          },
        ),
    

提交回复
热议问题