Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Flutter Drawer corner radius

Tags:

flutter

I am using Drawer with a BottomAppBar. When I click the menu icon it shows the Drawer. I want to change the top left and top right corner radius of Flutter Drawer. Is it possible to customize the corner radius?

like image 364
bnayagrawal Avatar asked Jan 07 '19 10:01

bnayagrawal


3 Answers

You can try to wrap Drawer in ClipRRect

ClipRRect(
  borderRadius: BorderRadius.vertical(top: Radius.circular(4.0)),
  child: Drawer(...),
)
like image 122
Andrey Turkovsky Avatar answered Oct 18 '22 23:10

Andrey Turkovsky


Found the solution. Just have to add canvasColor: Colors.transparent to the MaterialApp theme and it will work.

like image 33
bnayagrawal Avatar answered Oct 19 '22 00:10

bnayagrawal


Drawer in Flutter already have a shape property which can be used to change the shape of drawer. Below is the code to change corner radius of Drawer:

         Drawer(
            shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.only(
                  topRight: Radius.circular(20),
                  bottomRight: Radius.circular(20)),
            ),
            child: .....
          ),

There is no need of wrapping drawer around any widget.

like image 9
Priyansh jain Avatar answered Oct 19 '22 00:10

Priyansh jain