在我的 Flutter 应用中,我有这个 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();
}
)
],
),
);
}
看起来像:
As you can see on the AppBar, there is some extra padding around the leading icon. How can I remove this extra padding.
最佳答案
只需添加一个名为 titleSpacing 的属性,
样本
appBar: AppBar(
leading: Icon(Icons.android),
titleSpacing: 0,
title: Text(widget.title),
),
https://stackoverflow.com/questions/50460629/
相关文章:
dictionary - flutter/Dart : How to access a single
dart - 如何使用 flutter 编写按下双后退按钮以退出应用程序
flutter - 如何将焦点转移到 Flutter 中的下一个 TextField?
dart - 如何在 Flutter 中使一些文本可点击(响应点击)?
dart - Flutter 在 `flutter` 命令上失败
android - Flutter - 另一个 Listview 中的 Listview.build
android - 如何在 Flutter 中为按钮添加渐变?