Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter floating action button in a CustomScrollView

Tags:

flutter

dart

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?

like image 325
Ian Cruz Avatar asked Oct 19 '25 13:10

Ian Cruz


1 Answers

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.

like image 139
xster Avatar answered Oct 21 '25 04:10

xster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!