Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bottom navbar rounded corners

Tags:

flutter

dart

I'm trying to give some rounded corners to my bottom navbar. For that, I have to make the background of its container transparent but I don't know how.

This is what I did int the Scaffold:

bottomNavigationBar: ClipRRect(
        borderRadius: BorderRadius.only(topLeft: Radius.circular(30.0), topRight: Radius.circular(30.0), ),
        child:BottomNavigationBar(
          //elevation: 0.0,
          type: BottomNavigationBarType.fixed,
          backgroundColor: Colors.white10,

and the result :

enter image description here

There is still by default a white background. I tried to wrap my ClipRRect in a container with a transparent background but it did not work.

Any idea ?

like image 351
user54517 Avatar asked Aug 03 '19 17:08

user54517


People also ask

How do you give border radius to the bottom navigation bar?

Alternatively, if your goal is to only put a borderRadius you can just use ClipRRect and apply your desired borderRadius to it. Here is my implementation of the solution: ClipRRect _getBtmNavBar() { return ClipRRect( borderRadius: BorderRadius. only( topLeft: Radius.


1 Answers

need a little bit shadow like

bottomNavigationBar: Container(                                             
  decoration: BoxDecoration(                                                   
    borderRadius: BorderRadius.only(                                           
      topRight: Radius.circular(30), topLeft: Radius.circular(30)),            
    boxShadow: [                                                               
      BoxShadow(color: Colors.black38, spreadRadius: 0, blurRadius: 10),       
    ],                                                                         
  ),                                                                           
  child: ClipRRect(                                                            
    borderRadius: BorderRadius.only(                                           
    topLeft: Radius.circular(30.0),                                            
    topRight: Radius.circular(30.0),                                           
    ),                                                                         
    child: BottomNavigationBar(                                                
      items: <BottomNavigationBarItem>[                                        
        BottomNavigationBarItem(                                               
          icon: Icon(Icons.favorite), title: Text('Favourite')),               
        BottomNavigationBarItem(                                               
          icon: Icon(Icons.favorite), title: Text('Favourite'))                
      ],                                                                       
    ),                                                                         
  )                                                                            
)

without shadow :

without shadow :- with shadow : with shadow

like image 155
Mohamed Gaber Avatar answered Oct 23 '22 05:10

Mohamed Gaber