简体   繁体   中英

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?

I want to be able to have the default behaviour of a sliver list with a FAB fixed on the screen.

Is it possible?

You can still use the Scaffold when you're using the SliverAppBar such as:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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