减少 flutter 中应用栏按钮的填充

Ami*_*mit 2 appbar dart flutter

如何减少按钮之间的间距?

您可以看到应用程序栏上的四个按钮占用了很多空间,我尝试过行。但没有工作

在此输入图像描述 下面是我的代码——

 AppBar(
  backgroundColor: Colors.deepOrange,
  iconTheme: new IconThemeData(color: Colors.white),
  title: Text(
    titleString,
    style: TextStyle(color: Colors.white),
  ),

  actions: <Widget>[

    IconButton(

      icon: Icon(
        Icons.search,
        color: Colors.white,
      ),
      //iconSize: 20,
      onPressed: null,
    ),
    IconButton(
      icon: Icon(
        Icons.notifications_none,
        color: Colors.white,
      ),
     // iconSize: 20,

      onPressed: null,
    ),
    //Add more icon here

  ],
);
Run Code Online (Sandbox Code Playgroud)

小智 7

您可以将 VisualDensity 和 padding 参数一起使用来减少事情:

actions: <Widget>[

IconButton(
  visualDensity: VisualDensity(horizontal: -4.0, vertical: -4.0),
  padding: EdgeInsets.zero,
  icon: Icon(
    Icons.search,
    color: Colors.white,
  ),
  //iconSize: 20,
  onPressed: null,
),
//Add more icon here

],
Run Code Online (Sandbox Code Playgroud)

这至少在我的应用程序中有效。希望它有帮助!