相关疑难解决方法(0)

如何删除Flutter中AppBar前导图标周围的额外填充

在我的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();
            }
        )
      ],
    ),
  );
}
Run Code Online (Sandbox Code Playgroud)

看起来像:

在此输入图像描述

正如你在AppBar上看到的那样,领先图标周围有一些额外的填充.如何删除这个额外的填充.

dart flutter flutter-layout

9
推荐指数
7
解决办法
1万
查看次数

标签 统计

dart ×1

flutter ×1

flutter-layout ×1