如何在Flutter中的Stack Widget中添加多个浮动按钮 [英] How to add Multiple Floating button in Stack Widget in Flutter
问题描述
使用 Stack Widget 在一个视图上切换另一个视图.很好现在,我需要在屏幕底部的左侧和右侧添加两个浮动按钮.我在右侧添加了一个按钮,但我不知道如何在左侧添加浮动按钮.就像下面的图片一样简单.
In flutter one view over another view using Stack Widget. It's work fine. Now I need to added two floating button left and right side of bottom of screen. I added one button right side but I dnt know how to add floating button left side. Simple like below image.
任何帮助都是有意义的
推荐答案
您可以使用 FloatingActionButton
的在 Stack
中.
You can use the Align
widget to position your FloatingActionButton
's in the Stack
.
Stack(
children: <Widget>[
Align(
alignment: Alignment.bottomLeft,
child: FloatingActionButton(...),
),
Align(
alignment: Alignment.bottomRight,
child: FloatingActionButton(...),
),
],
)
一个按钮的alignment
属性使用常量Alignment.bottomLeft
,另一个按钮分别使用Alignment.bottomRight
.
One button uses constant Alignment.bottomLeft
for its alignment
property and the other one respectively Alignment.bottomRight
.
这篇关于如何在Flutter中的Stack Widget中添加多个浮动按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!