'Change Flutter Drawer corner radius

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?



Solution 1:[1]

You can try to wrap Drawer in ClipRRect

ClipRRect(
  borderRadius: BorderRadius.vertical(top: Radius.circular(4.0)),
  child: Drawer(...),
)

Solution 2:[2]

This is how you should behave.

 drawer: ClipRRect(
      borderRadius: BorderRadius.only(
          topRight: Radius.circular(35), bottomRight: Radius.circular(35)),
      child: Drawer(...),),

Solution 3:[3]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrey Turkovsky
Solution 2 Javid Sattar
Solution 3 Priyansh jain