Flutter: How to attach a FloatingActionButton to the AppBar?

hendra picture hendra · Apr 26, 2018 · Viewed 8.6k times · Source

The Scaffold-Widget only allows to place a FloatingActionButton at the bottom right or the bottom center. How can I place it between AppBar and body like here?

[A floating action button attached to the app bar[1]

Answer

Marco picture Marco · Jan 16, 2020

It is now possible using:

Scaffold(
      appBar: AppBar(title: Text('Title'),),
      body: ...,
      floatingActionButtonLocation: FloatingActionButtonLocation.endTop,
      floatingActionButton: FloatingActionButton(...),
    ),