Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove extra padding around AppBar leading icon in Flutter

In my Flutter app, I have this AppBar

Widget setAppBar(){   return new AppBar(     title: addAppBarTextWidget('Explore'),     elevation: 0.0,     leading: addLeadingIcon(),     actions: <Widget>[       addAppBarActionWidget(Constant.iconNotification, 22.0, 16.0, 8.0),       addAppBarActionWidget(Constant.iconProfile, 30.0, 30.0, 15.0)     ],   ); }  Widget addLeadingIcon(){   return new Container(     height: 25.0,     width: 25.0,     padding: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),     margin: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),     child: new Stack(       alignment: AlignmentDirectional.center,       children: <Widget>[         new Image.asset(           Constant.iconNotification,           width: 25.0,           height: 25.0,         ),         new FlatButton(             onPressed: (){               onLeadingShowCategoryClick();             }         )       ],     ),   ); } 

it looks like:

enter image description here

As you can see on the AppBar, there is some extra padding around the leading icon. How can I remove this extra padding.

like image 807
Rafiqul Hasan Avatar asked May 22 '18 05:05

Rafiqul Hasan


People also ask

How do I get rid of padding in AppBar Flutter?

How to Remove Extra Padding Around AppBar Leading Icon In Flutter ?? appBar: AppBar( automaticallyImplyLeading: false, // Don't show the leading button title: Row( mainAxisAlignment: MainAxisAlignment. start, crossAxisAlignment: CrossAxisAlignment. center, children: <Widget>[ IconButton( onPressed: () => Navigator.

How do I remove space between AppBar and body Flutter?

You just need to wrap the Column(Which is inside SingleChildScrollView) with Container and give its height and width.

How do you remove leading in Flutter AppBar?

A simple way to remove the back button in the AppBar Widget is to set automaticallyImplyLeading to false.


1 Answers

Just add a property called titleSpacing,

Sample

appBar: AppBar(         leading: Icon(Icons.android),         titleSpacing: 0,         title: Text(widget.title),       ), 
like image 124
Vinoth Kumar Avatar answered Sep 18 '22 22:09

Vinoth Kumar