修复底部的小部件 space

Fix widget in bottom space

我需要一些布局方面的帮助。

我需要在 "Scrollview" 中放置一些小部件,但将按钮保留在屏幕底部 space。

Image with a "Scrollview" with some textFields inside, and under de "Scrollview" a Rows containing two buttons

因此,如果我改变方向,布局会将按钮保持在底部,并将小部件滚动到上方。

如何在flutter中实现,我尝试使用Stack,Listview等方法,但我没有运气

多种方式。我建议您使用 Scaffold or a Column:

如果您已经在您的应用中使用脚手架,只需添加 bottomNavigatorBar 作为参数,您想要的栏位于它的底部,并确保布局的其余部分位于它的下方body 标签。

否则您可以使用列:

Column( 
children: <Widget> [ 
Expanded(child:ScrollView(..),),
 yourBottomBar, 
] )

或者 Flutter 还有一个 Positioned 小部件,您可以将它与 Stack 结合使用:

Stack(
  children: [
    // some stuff
    Positioned(
      bottom: 0,
      child: yourBottomBar
    ),
  ],
)