I have the same problem that I do not want my users to accidently dismiss the drawer, wich contains a form, on swipe or click outside.
My work around solution is to wrap the content of the drawer in a GestureDetector and then add:
onHorizontalDragEnd: (v) {
// do nothing
},
Closing by tapping outside however is still posible, so I fixed that like this: make the drawer 100% width with transparant background and give a desired endDrawerWidth to the child of the Drawer.
complete example:
return Scaffold(
endDrawerEnableOpenDragGesture: false,
endDrawer: Container(
width: MediaQuery.of(context).size.width,
child: Drawer(
backgroundColor: Colors.transparent,
child: GestureDetector(
onHorizontalDragEnd: (v) {
// do nothing
},
child: Row(
children: [
Expanded(child: Container(color: Colors.transparent,)),
Container(
/// replace by your desired width
width: MediaQuery.of(context).size.width/2,
color: Colors.white,
child: Center(child: Text("your content")),
),
],
),
),
),
),
body: Center(child: Text("your boby")),
);