Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BottomAppBar Floating action button notch/inset is not transparent

Tags:

flutter

I've added a BottomAppBar to scaffold in a materialApp, and to that I've added a fab with a inset at the center. The code looks somewhat like this

Scaffold(
    bottomNavigationBar: BottomAppBar(
        color: Theme.of(context).accentColor,
        shape: CircularNotchedRectangle(),
        child: _buildBottomBar(context),
    ),
    floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
    floatingActionButton: FloatingActionButton(
        backgroundColor: Theme.of(context).primaryColor,
        child: Center(
        child: Icon(
            Icons.add,
            size: 32.0,
        ),
        ),
        onPressed: () {
        Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => CreateEvent()),
        );
        },
    ),
)

And this is what I'm getting after rendering:

enter image description here

The notch is not transparent, and the content behind it is getting hidden.

Is there a way to fix this? Something I might have missed?

like image 699
ishaan Avatar asked Oct 01 '18 13:10

ishaan


People also ask

What is the default size for floating action button?

The new floating action button should be 56dp x 56dp and the icon inside it should be 24dp x 24dp.

How do I change the position of my floating action button?

By default, the shape of the floating action button (FAB) in the flutter is circular and the location is bottom right floated. You can change the location and shape of the floating action button using properties in Scaffold() widget class and FloatingActionButton() widget class.

How do I get rid of the floating button in flutter?

How to Disable Button in Flutter. To disable button in Flutter, just assign the null value to the onPressed parameter of the Button.


1 Answers

You just need to be on the flutter channel: master and then add to Scaffold:

Scaffold(
   extendBody: true
);

and it should be transparent :)

Greets

Rebar

UPDATE:

You don't need to be on master channel. It's included everywhere :)

like image 66
Rebar Avatar answered Oct 20 '22 03:10

Rebar