简体   繁体   English

CustomScrollView中的Flutter浮动操作按钮

[英]Flutter floating action button in a CustomScrollView

Is there any way to include a Floating Action Button in a screen consisting of a CustomScrollView with a SliverAppBar and a SliverList? 有什么方法可以在由带有SliverAppBar和SliverList的CustomScrollView组成的屏幕中包括一个浮动动作按钮吗?

I want to be able to have the default behaviour of a sliver list with a FAB fixed on the screen. 我希望能够在屏幕上固定有FAB的情况下,具有银条列表的默认行为。

Is it possible? 可能吗?

You can still use the Scaffold when you're using the SliverAppBar such as: 使用SliverAppBar时,仍然可以使用Scaffold,例如:

new Scaffold(
  body: new CustomScrollView(
    slivers: <Widget>[
      new SliverAppBar(...),
      ...
    ],
  ),
  floatingActionButton: new FloatingActionButton(...),
);

Otherwise, you can generally use a Stack above the CustomScrollView and the FloatingActionButton (in a Positioned) as well. 否则,通常也可以在CustomScrollView和FloatingActionButton(位于Positioned)上方使用Stack。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM