How to remove extra padding around AppBar leading icon in Flutter

后端 未结 8 1157
陌清茗
陌清茗 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 09:19

    You can't do this because it is a predefined widget. You can, however, do this:

    appBar: AppBar(
      automaticallyImplyLeading: false, // Don't show the leading button
      title: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          IconButton(
            onPressed: () => Navigator.pop(context),
            icon: Icon(Icons.arrow_back, color: Colors.white),
          ),
          // Your widgets here
        ],
      ),
    ),
    

    Where automaticallyImplyLeading: true hides the leading IconButton so you can add your own widgets.

提交回复
热议问题