如何在Flutter中的FloatingActionButton之间留出空隙?

问题描述 投票:0回答:2

我只是开始颤抖,而不是要如何在这2个FloatingActionButton之间留出空隙

 Widget abcde = Container(
  child: new Row(
    children: <Widget>[
      Expanded(
          child: new Container(
            margin: new EdgeInsets.symmetric(horizontal: 20.0),
            child: new Row(
              children: <Widget>[
                FloatingActionButton(
                    backgroundColor: Colors.blue,
                    onPressed: (){},
                    child: Icon(Icons.call)),
                FloatingActionButton(
                    backgroundColor: Colors.blue,
                    onPressed: (){},
                    child: Icon(Icons.call)),
              ],
            ),
          )
      ),
    ],
  ),
);

My Flutter App

flutter flutter-layout flutter-animation
2个回答
0
投票
添加SizedBox。

FloatingActionButton( backgroundColor: Colors.blue, onPressed: () {}, child: Icon(Icons.call)), SizedBox( width: 10, ), FloatingActionButton( backgroundColor: Colors.blue, onPressed: () {}, child: Icon(Icons.call)),


0
投票
有很多方法可以解决这个问题:

    mainAxisAlignment: MainAxisAlignment.spaceEvenly,小部件添加Row或其他间距选项。
  1. FloatingActionButtons包装Container并添加边距/边距,或直接用Padding / Margin小部件包装。
  2. 在它们之间添加小部件,例如Container /SizedBox/ Spacer
  • 我推荐1:

    Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ //Fab 1, //Fab 2 ] ),

  • © www.soinside.com 2019 - 2024. All rights reserved.