How to implement rounded bottomAppbar in flutter?

5.9k views Asked by At

I want to create a rounded Bottomappbar like this one.
Rounded BottomAppBar:

1

But it appears like this... Coded BottomAppBar:

2 How do I get rid of that white portion?

    return ClipRRect(
      borderRadius: BorderRadius.only(
        topLeft: Radius.circular(25),
        topRight: Radius.circular(25),
        bottomRight: Radius.circular(25),
        bottomLeft: Radius.circular(25),
      ),
      child: Padding(
        padding: const EdgeInsets.only(bottom:20.0),
        child: BottomAppBar(
    
   shape: CircularNotchedRectangle(),
   child: new Row(
        
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        
        children: <Widget>[
          IconButton(
            icon: Icon(Icons.menu),
            color: Colors.white,
            onPressed: () {},
          ),
          IconButton(
            icon: Icon(Icons.search),
            color: Colors.white,
            onPressed: () {},
          ),
        ],
    ),
    color: Colors.blueGrey,
    ),
      )
    ); ```
2

There are 2 answers

3
Jagadish On BEST ANSWER

App bar widget has a shape property and that's what you should use to get desired results, change your code to this

BottomAppBar(
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.all(
        topLeft: Radius.circular(25),
        topRight: Radius.circular(25),
        bottomRight: Radius.circular(25),
        bottomLeft: Radius.circular(25),
      ),
    ),
   ... //Your codes
  ),
0
Jayvardhan Patil On

As @Jagadish suggested I used Shape: RoundedRectangleBorder to get rounded BottomAppBar. However to get notched bar I used:

    shape: AutomaticNotchedShape(
RoundedRectangleBorder(
      borderRadius: BorderRadius.all(Radius.circular(25),
 ),
StadiumBorder(),
    ),
   ... //Codes=
  ),

This also gives a notch for Extended Floating Action Button and (I think) for Buttons with diff shapes.