Ian Cruz
Ian Cruz

Reputation: 75

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?

Upvotes: 4

Views: 6047

Answers (1)

xster
xster

Reputation: 6667

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.

Upvotes: 10

Related Questions