FloatingActionButton结束对齐剪切图标

问题描述 投票:1回答:1

我最后定位了一个FloaatingActionButton(我希望有一个右下方的对齐)但不幸的是它离右边太远了,底部的一部分被边缘切断了

            Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: <Widget>[
                FloatingActionButton(
                  onPressed: displayDialog,
                  child: Icon(
                    Icons.queue_music,
                  ),
                  foregroundColor: Colors.white,
                  backgroundColor: Colors.red[900],
                )
              ],
            ),

enter image description here

如何添加一些间距并避免这种重叠?

dart flutter
1个回答
1
投票

在FAB右边有一些边距之后,在窗口小部件中添加容器作为Row的子节点

   Row(
          mainAxisAlignment: MainAxisAlignment.end,
          children: <Widget>[
            FloatingActionButton(
              onPressed: displayDialog,
              child: Icon(
                Icons.queue_music,
              ),
              foregroundColor: Colors.white,
              backgroundColor: Colors.red[900],
            ),
             Container(
               margin: EdgeInsets.only(right: someMargin),
             ),
          ],
        ),
© www.soinside.com 2019 - 2024. All rights reserved.