In my Flutter app, I have this AppBar
Widget setAppBar(){
return new AppBar(
title: addAppBarTextWidget(\'Explore\'),
elevation: 0.0,
leading:
You can try this, this works fine. when you set the leading = null then extra space of leading widget will remove.
appBar: new AppBar(
leading: null,
titleSpacing: 0.0,
title: new Text("title"),
),
Just add a property called titleSpacing,
Sample
appBar: new AppBar(
leading: new Icon(Icons.android),
titleSpacing: 0.0,
title: new Text(widget.title),
),
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
);
},
),
just set titleSpacing
and automaticallyImplyLeading
for remove space
like
AppBar(
titleSpacing: 0,
automaticallyImplyLeading: false,
)
AppBar(
leading: Transform.translate(
offset: Offset(-15, 0),
child: Icon(Icons.android),
),
titleSpacing: -30,
centerTitle: false,
title: Text("Title"),
)
If you don't want to use any leading widget:
AppBar(
title: Text('Title'),
centerTitle: false,
titleSpacing: 0,
)
If you use Widgets from Material package, they are defined respecting Material Design specification document. So if your modification violates this spec, you have to build your own Widget instead of using the Material Widgets.